-
Notifications
You must be signed in to change notification settings - Fork 281
feat(ui5-avatar): implement accessibilityInfo getter #12613
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
Open
IlianaB
wants to merge
6
commits into
main
Choose a base branch
from
avatar-accessibilityinfo-getter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e9d0b48
feat(ui5-avatar): implement accessibilityInfo getter
IlianaB be49255
Merge branch 'main' into avatar-accessibilityinfo-getter
IlianaB 524e9f4
chore: make type of avatar translatable and return the info object al…
IlianaB 2696a7f
chore: fix lint errors
IlianaB 1d7da41
correct type of avatar is returned
IlianaB 5958f38
fix lint error
IlianaB File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ import slot from "@ui5/webcomponents-base/dist/decorators/slot.js"; | |
| import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js"; | ||
| import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js"; | ||
| import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js"; | ||
| import type { AccessibilityAttributes } from "@ui5/webcomponents-base/dist/types.js"; | ||
| import type { AccessibilityAttributes, AriaRole } from "@ui5/webcomponents-base/dist/types.js"; | ||
| import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js"; | ||
| import type { ITabbable } from "@ui5/webcomponents-base/dist/delegate/ItemNavigation.js"; | ||
| import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js"; | ||
|
|
@@ -493,6 +493,18 @@ class Avatar extends UI5Element implements ITabbable, IAvatarGroupItem { | |
| } | ||
| this._imageLoadError = true; | ||
| } | ||
|
|
||
| get accessibilityInfo() { | ||
| if (this._interactive) { | ||
| return { | ||
| role: this._role as AriaRole, | ||
| type: this._ariaHasPopup, | ||
| description: this.accessibleNameText, | ||
| }; | ||
| } | ||
|
|
||
| return undefined; | ||
|
||
| } | ||
| } | ||
|
|
||
| Avatar.define(); | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
As mentioned in the other change, just like in UI5, the
typeshould be translatable.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.
Hello @aborjinik ,
thank you for your comments. Changes are still in progress.
I wonder regarding the roles - should they also be translatable? Like in this case role could be "button" or "img". But "img" should be read out as "Image" (best case) and there is no such AriaRole? What should we do in this case?
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.
Nevermind. I think I got it - table (and also customlistitem) will use only type, NOT ROLE, when they construct the string description of all acccessibilityInfo properties of a component.
In case component does not have specific "type" (like CheckBox has role=checkbox and that's it, "CheckBox" will be also returned as type but translatable). When component have different "type" than "role" (like in Avatar - it's role is Button or Img, but "type" can come from hasPopup /menu, listbox, etc/ - "type" will be the translatable value of "hasPopup". Or Select - "role" is "combobox", but more specific type is "listbox" -> listbox is returned as type, translatable).