Skip to content

refactor(ui5-link): change the accessibleRole property type#8807

Merged
ilhan007 merged 11 commits intoUI5:mainfrom
unazko:link_accessible_role_type_change
May 14, 2024
Merged

refactor(ui5-link): change the accessibleRole property type#8807
ilhan007 merged 11 commits intoUI5:mainfrom
unazko:link_accessible_role_type_change

Conversation

@unazko
Copy link
Copy Markdown
Contributor

@unazko unazko commented Apr 19, 2024

The accessibleRole property of the ui5-link component now takes the enum LinkAccessibleRole with default value of Link.
The usage of this property from application perspective would not get changed since string values are still accepted.

Related to: #8461

Copy link
Copy Markdown
Contributor

@hinzzx hinzzx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Copy Markdown
Contributor

@tsanislavgatev tsanislavgatev left a 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.

@unazko unazko requested a review from ilhan007 April 26, 2024 07:12
@unazko unazko marked this pull request as ready for review May 7, 2024 14:43
Copy link
Copy Markdown
Contributor

@ilhan007 ilhan007 left a 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.

@unazko unazko requested a review from ilhan007 May 11, 2024 03:58
@unazko unazko mentioned this pull request May 11, 2024
Copy link
Copy Markdown
Contributor

@ilhan007 ilhan007 left a 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

@unazko unazko requested a review from ilhan007 May 13, 2024 13:22
@ilhan007 ilhan007 merged commit 2cc64cc into UI5:main May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants