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
refactor(ui5-link): change the accessibleRole property type #8807
Conversation
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.
LGTM.
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.
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.
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.
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
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.
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
accessibleRole
property of theui5-link
component now takes the enumLinkAccessibleRole
with default value ofLink
.The usage of this property from application perspective would not get changed since
string
values are still accepted.Related to: #8461