Skip to content
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

fix: added rel prop in switcher item #17059

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7566,6 +7566,9 @@ Map {
"onKeyDown": Object {
"type": "func",
},
"rel": Object {
"type": "string",
},
"tabIndex": Object {
"type": "number",
},
Expand Down
10 changes: 10 additions & 0 deletions packages/react/src/components/UIShell/SwitcherItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ interface BaseSwitcherItemProps {
* Specify where to open the link.
*/
target?: HTMLAttributeAnchorTarget;
/**
* The rel property for the link.
*/
rel?: string;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a specific type off of HTMLAttributes or DOMAttributes or something that we could use here? It's not any string - it's one of a specific set of allowed/expected strings, right?

MDN's list is "some of the most important existing keywords" 🤔 very possible this doesn't exist but figured I'd ask

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we cannot add any string there are some specific keywords that can be used . What do you think should I create an interface and made rel at that type ??

}

interface SwitcherItemWithAriaLabel extends BaseSwitcherItemProps {
Expand Down Expand Up @@ -89,6 +93,7 @@ const SwitcherItem = forwardRef<ElementType, SwitcherItemProps>(
onKeyDown = () => {},
href,
target,
rel,
...rest
} = props;

Expand Down Expand Up @@ -132,6 +137,7 @@ const SwitcherItem = forwardRef<ElementType, SwitcherItemProps>(
}}
href={href}
target={target}
rel={rel}
ref={forwardRef}
{...rest}
className={linkClassName}
Expand Down Expand Up @@ -183,6 +189,10 @@ SwitcherItem.propTypes = {
* Specify where to open the link.
*/
target: PropTypes.string,
/**
* The rel property for the link.
*/
rel: PropTypes.string,
};

export default SwitcherItem;
Loading