-
Notifications
You must be signed in to change notification settings - Fork 355
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
Consume core Penta updates: Form controls, checkbox, radio #10016
Conversation
Preview: https://patternfly-react-pr-10016.surge.sh A11y report: https://patternfly-react-pr-10016-a11y.surge.sh |
d942c19
to
12d4059
Compare
I updated the
|
A post-v6 breaking change would mean v7, so I think we should try to clean this up now versus later (depending on the remaining v6 work priority). I do like |
I replaced the Codemod issue followup: patternfly/pf-codemods#583 |
7613d4c
to
2387f76
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.
One comment, but it's GTG as it is, too!
className, | ||
...props | ||
}) => ( | ||
<Button aria-label={ariaLabel} className={className} variant="plain" hasNoPadding {...props}> |
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'll just mention that in core we use the <span>
version of the button component here to help with line wrapping, though IIRC I don't know that it will make any sort of difference on the react side.
The reason for ^ is that some users want the help icon to wrap with the label text - or more specifically, they don't want the help icon to wrap on its own line (orphan), so it needs to wrap with at least one word of the label text. We can't get the label text to wrap with a <button>
, but it will wrap with a <span>
. However, another thing we can't get to wrap with text is an <svg>
- which is how react-icons' icons are delivered. So even if we make the button a <span>
, since react uses <svg>
's for the icons, it won't wrap with the text anyways.
I might suggest using the <span>
anyways, if there are no real downsides to using that in favor of a <button>
, on the off chance that we're able to figure out how to get an <svg>
to wrap with text. That would also allow a user to pass a non-svg as the icon if we ever added that support - doesn't look like it's supported now.
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.
@mcoker Good point Michael!
I remember I actually was applying component="span"
and isInline
props before to match the core implementation (which in combination leads to these attributes: type="button" role="button" tabindex="0"
being added on the <span>
element, which is exactly what is in core).
So I was wondering why it is not there now.
I was just about to commit your suggestion and then I realized why I did not apply the component="span"
back then. The reason is accessibility of the Popover
. Although the tabindex="0"
makes the span focusable, the Popover cannot be opened on pressing the enter key. It works only if the element is a <button>
.
Seems like this issue is related to the implementation of the Popover, so I am taking a look at that now.
For now I would keep it as <button>
, so the Popover is accessible, and once we figure that out, we can add the component="span"
and isInline
props to match core.
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.
@adamviktora nice, thanks for digging in and for the explanation! Sounds like a plan 👍👍
@@ -2,16 +2,13 @@ import * as React from 'react'; | |||
import styles from '@patternfly/react-styles/css/components/Form/form'; | |||
import { css } from '@patternfly/react-styles'; | |||
|
|||
// typo - rename to FormFieldGroupHeaderTitleTextObject during breaking change release | |||
export interface FormFiledGroupHeaderTitleTextObject { | |||
export interface FormFieldGroupHeaderTitleTextObject { |
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 is exported, do we have codemod issue for 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.
Thanks for the catch! now we do: patternfly/pf-codemods#609
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
…tion "start" / "end"
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.
There are a couple spacing things here but I think that falls more in a core followup issue so I am going to make that now.
Your changes have been released in:
Thanks for your contribution! 🎉 |
What: Closes #9931, closes #10055
Things done:
FormGroupLabelHelp
component to make usinglabelIcon
prop simpleBreaking changes done:
labelIcon
prop in FormGroup tolabelHelp
isLabelBeforeButton
prop in Checkbox/Radio tolabelPosition?: 'start' | 'end'
Todo:
isLabelWrapped
andlabelPosition="start"
(issue: Checkbox - add examples of "Reversed" and "Label wraps" #10085)