-
Notifications
You must be signed in to change notification settings - Fork 359
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
feat(JumpLinks): consumed Penta updates #10027
Conversation
import { JumpLinksList } from './JumpLinksList'; | ||
|
||
export interface JumpLinksItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onClick'> { | ||
/** Whether this item is active. Parent JumpLinks component sets this when passed a `scrollableSelector`. */ | ||
isActive?: boolean; | ||
/** Href for this link */ | ||
href?: string; | ||
href: string; |
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.
This needs to be required, as without it the anchor internal to the component cannot receive keyboard focus.
If the intent is that a consumer can pass either an href to link to an ID on the page, or the onClick to handle this functionality themselves, then we would need to render either an anchor with an href or a button with the onClick, not an anchor with either/both.
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.
Should we make a codemod to at least warn consumers about this?
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.
<span className={styles.jumpLinksLinkText}>{children}</span> | ||
</a> | ||
<span className={styles.jumpLinksLink}> | ||
<a className={css(buttonStyles.button, buttonStyles.modifiers.link)} href={href} onClick={onClick}> |
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.
Passed the classes in instead of using Button with props just to retain the onClick event type. No strong opinion about this, so I can just update the onClick event type and use the Button component proper here instead if we want.
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 would update this to use the Button if possible.
Preview: https://patternfly-react-pr-10027.surge.sh A11y report: https://patternfly-react-pr-10027-a11y.surge.sh |
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.
It'd be nice to do a v6 org bump once this merges, then the jumplinks used navigate between examples in the docs can have the same hover styles in the workspace.
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.
sweet moves. Done like dinner.
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.
Beautiful 🤹
<span className={styles.jumpLinksLinkText}>{children}</span> | ||
</a> | ||
<span className={styles.jumpLinksLink}> | ||
<a className={css(buttonStyles.button, buttonStyles.modifiers.link)} href={href} onClick={onClick}> |
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 would update this to use the Button if possible.
0e5b35b
to
4a94da0
Compare
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
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #9994
Additional issues: