refactor(ui5-link): change the accessibleRole property type#8807
refactor(ui5-link): change the accessibleRole property type#8807
Conversation
tsanislavgatev
left a comment
There was a problem hiding this comment.
I have some doubts about the name of the Enum if we use it in both controls, but I can't think of a better one at the moment.
ilhan007
left a comment
There was a problem hiding this comment.
Having ButtonAccessibleRole type for a property in the Link seems a little odd. I would prefer duplication of the enum with "Link" in the name.
Option 1: Creating a LinkAccessibleRole enum (duplicate of ButtonAccessibleRole enum) with the same fields and using it in Link.ts:
/// Link.ts
@property({ type: LinkAccessibleRole, defaultValue: LinkAccessibleRole.Link })
accessibleRole!: `${LinkAccessibleRole}`;Option 2: Creating enums as in Option 1 + reusing the base AriaRole:
/// Button.ts
import AriaRole from "@ui5/webcomponents-base/dist/types/AriaRole.js";
enum ButtonAccessibleRole {
Button = AriaRole.Button,
Link = AriaRole.Link
}/// Link.ts
import AriaRole from "@ui5/webcomponents-base/dist/types/AriaRole.js";
enum LinkAccessibleRole {
Button = AriaRole.Button,
Link = AriaRole.Link
}Don't have a preference over these two, I am open for other suggestions as well.
The main point is that ButtonAccessibleRole will be displayed in Link's API reference as type for the Link#accessibleRole property and it's a bit confusing.
…accessible_role_type_change
ilhan007
left a comment
There was a problem hiding this comment.
ButtonAccessibleRole and LinkAccessibleRole are still public enums and have to be documented accordingly and also consumers should be able to import them.
Now that I thought about the "import" aspect, it's better to choose option1
- revert the ButtonAccessibleRole in types
- add LinkAccessibleRole in types
…accessible_role_type_change
The
accessibleRoleproperty of theui5-linkcomponent now takes the enumLinkAccessibleRolewith default value ofLink.The usage of this property from application perspective would not get changed since
stringvalues are still accepted.Related to: #8461