-
Notifications
You must be signed in to change notification settings - Fork 275
fix(ui5-input): Announce selected item #1578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a845713
ed72225
96f0f9f
e0dac3c
87bd0f2
10e5b3c
9b8609a
0c84432
d66a868
c9599a7
42d267f
5f6a3b3
6f72620
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -623,6 +623,8 @@ class Input extends UI5Element { | |
} | ||
|
||
_afterClosePopover() { | ||
this._announceSelectedItem(); | ||
|
||
// close device's keyboard and prevent further typing | ||
if (isPhone()) { | ||
this.blur(); | ||
|
@@ -707,6 +709,7 @@ class Input extends UI5Element { | |
previewSuggestion(item) { | ||
this.valueBeforeItemSelection = this.value; | ||
this.value = item.group ? "" : item.textContent; | ||
this._announceSelectedItem(); | ||
} | ||
|
||
async fireEventByAction(action) { | ||
|
@@ -798,6 +801,16 @@ class Input extends UI5Element { | |
}; | ||
} | ||
|
||
_announceSelectedItem() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this function change the value of the new property. This will invalidate and set it. Don't manipulate DOM directly. |
||
const invisibleText = this.shadowRoot.querySelector(`#${this._id}-selectionText`); | ||
|
||
if (this.Suggestions && this.Suggestions._isItemOnTarget()) { | ||
invisibleText.textContent = this.itemSelectionAnnounce; | ||
} else { | ||
invisibleText.textContent = ""; | ||
} | ||
} | ||
|
||
get _readonly() { | ||
return this.readonly && !this.disabled; | ||
} | ||
|
@@ -837,6 +850,10 @@ class Input extends UI5Element { | |
}; | ||
} | ||
|
||
get itemSelectionAnnounce() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code logically belongs to InputSuggestions.js. The clue to this is that you don't actually use the state of Input.js, but refer to this.Suggestions for everything inside. Move it there, and in this method, if suggestions are imported by the user, just return a method call to suggestions |
||
return this.Suggestions ? this.Suggestions.itemSelectionAnnounce : undefined; | ||
} | ||
|
||
get classes() { | ||
return { | ||
popoverValueState: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bind a new private metadata state property here,inside the span, f.e. {{_announcementText}}
don't forget to declare it in
metadata