-
Notifications
You must be signed in to change notification settings - Fork 674
Lookup - Screen readers do not pick up NoDataText when Lookup is empty #35026
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -85,6 +85,7 @@ const LIST_SELECT_CHECKBOX = 'dx-list-select-checkbox'; | |
| const LIST_SELECT_RADIOBUTTON = 'dx-list-select-radiobutton'; | ||
| const WRAP_ITEM_TEXT_CLASS = 'dx-wrap-item-text'; | ||
| const SELECT_ALL_ITEM_SELECTOR = '.dx-list-select-all'; | ||
| export const SCREEN_READER_ONLY_CLASS = 'dx-screen-reader-only'; | ||
|
Contributor
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. Check if it can be imported.
Contributor
Author
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. we have two places where it's usable:
but I'm not sure import from this places right idea. What do you think?
Contributor
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. Check if we can reuse dx-gridbase-a11y-status-container
Contributor
Author
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 class was created for similar cases |
||
|
|
||
| const LIST_ITEM_DATA_KEY = 'dxListItemData'; | ||
| const LIST_FEEDBACK_SHOW_TIMEOUT = 70; | ||
|
|
@@ -132,6 +133,8 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |
|
|
||
| _$nextButton!: dxElementWrapper | null; | ||
|
|
||
| _$a11yStatusContainer?: dxElementWrapper; | ||
|
|
||
| _holdTimer?: ReturnType<typeof setTimeout>; | ||
|
|
||
| _loadNextPageTimer?: ReturnType<typeof setTimeout>; | ||
|
|
@@ -975,6 +978,7 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |
| this._itemElementsCache = $(); | ||
|
|
||
| this.$element().addClass(LIST_CLASS); | ||
| this._renderA11yStatusContainer(); | ||
| super._initMarkup(); | ||
|
|
||
| const { useInkRipple } = this.option(); | ||
|
|
@@ -997,10 +1001,35 @@ export class ListBase extends CollectionWidget<ListBaseProperties, Item> { | |
| const isEmpty = super._renderEmptyMessage(rootNodes); | ||
|
|
||
| this.setAria({ role: isEmpty ? undefined : 'application' }, this._focusTarget()); | ||
| this._updateA11yStatusText(); | ||
|
|
||
| return isEmpty; | ||
| } | ||
|
|
||
| _renderA11yStatusContainer(): void { | ||
| if (this._$a11yStatusContainer?.get(0)) { | ||
| return; | ||
| } | ||
|
|
||
| this._$a11yStatusContainer = $('<div>') | ||
| .addClass(SCREEN_READER_ONLY_CLASS) | ||
| .attr('role', 'status') | ||
| .appendTo(this.$element()); | ||
| } | ||
|
Comment on lines
+1009
to
+1018
|
||
|
|
||
| _updateA11yStatusText(): void { | ||
| if (this._dataController.isLoading()) { | ||
| this._$a11yStatusContainer?.text(''); | ||
| return; | ||
| } | ||
|
|
||
| const { noDataText } = this.option(); | ||
| const itemsCount = this._editStrategy.itemsGetter().length; | ||
| const itemsLabel = messageLocalization.format('dxList-listAriaLabel'); | ||
|
|
||
| this._$a11yStatusContainer?.text(itemsCount ? `${itemsLabel}: ${itemsCount}` : noDataText ?? ''); | ||
|
Contributor
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. Check what we need to announce.
Contributor
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. Check
Contributor
Author
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. |
||
| } | ||
|
|
||
| _isMultiSelectMode(): boolean { | ||
| const { selectionMode } = this.option(); | ||
| return selectionMode === 'multiple' || selectionMode === 'all'; | ||
|
|
||

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.
Check previous solution.
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.
#35054