-
Notifications
You must be signed in to change notification settings - Fork 280
feat(ui5-select): implement accessibilityInfo getter #12614
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 3 commits
17eb299
738df74
685ff22
182fdf0
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 |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ import "@ui5/webcomponents-icons/dist/information.js"; | |
| import { isPhone } from "@ui5/webcomponents-base/dist/Device.js"; | ||
| import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js"; | ||
| import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js"; | ||
| import type { Timeout } from "@ui5/webcomponents-base/dist/types.js"; | ||
| import type { Timeout, AriaRole } from "@ui5/webcomponents-base/dist/types.js"; | ||
| import InvisibleMessageMode from "@ui5/webcomponents-base/dist/types/InvisibleMessageMode.js"; | ||
| import { getScopedVarName } from "@ui5/webcomponents-base/dist/CustomElementsScope.js"; | ||
| import type { IFormInputElement } from "@ui5/webcomponents-base/dist/features/InputElementsFormSupport.js"; | ||
|
|
@@ -1174,6 +1174,20 @@ class Select extends UI5Element implements IFormInputElement { | |
| return ids.length ? ids.join(" ") : undefined; | ||
| } | ||
|
|
||
| get accessibilityInfo() { | ||
| const description = this.ariaLabelText | ||
| ? `${this.ariaLabelText}${this.text ? ` ${this.text}` : ""}` | ||
| : this.text || ""; | ||
|
|
||
| return { | ||
| role: "combobox" as AriaRole, | ||
| type: "listbox", | ||
|
||
| readonly: this.readonly, | ||
| required: this.required, | ||
|
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. It seems there is also a |
||
| description, | ||
| }; | ||
| } | ||
|
|
||
| _updateAssociatedLabelsTexts() { | ||
| this._associatedDescriptionRefTexts = getAllAccessibleDescriptionRefTexts(this); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Maybe you find this version more readable and more in line with functional programming principles
const description = [this.ariaLabelText, this.text].filter(Boolean).join(" ");