-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
InputBase: Add isBorderless
prop
#58750
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
disabled = false, | ||
isBorderless = false, | ||
isFocused = false, | ||
} ) { | ||
return ( | ||
<BackdropUI | ||
aria-hidden="true" | ||
className="components-input-control__backdrop" |
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.
Technically, we can already just use this .components-input-control__backdrop
selector to override border styles from any consumer. Still, I think it's better to control this centrally because it's intertwined with the border styles in the focused and disabled states, as you can see in the input-control-styles.tsx
file.
/** | ||
* Whether to hide the border when not focused. | ||
* | ||
* @default false | ||
*/ | ||
isBorderless?: boolean; |
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 prop shouldn't be exposed in the APIs of any public component.
@@ -213,7 +213,7 @@ export const Input = styled.input< InputProps >` | |||
box-sizing: border-box; | |||
border: none; | |||
box-shadow: none !important; | |||
color: ${ COLORS.gray[ 900 ] }; | |||
color: ${ COLORS.theme.foreground }; |
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.
Unrelated to borderless, but I'd like to sneak in this small enhancement for better themability if that's ok 🥺
Flaky tests detected in 4f38523. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7805003098
|
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.
🚀
Prerequisite for #56524 and possibly #57720
What?
Adds a
isBorderless
prop to the internal InputBase component, and connects the component to the Context System so it can also be toggled "under the table".Why?
Some recent design specs require the border to be hidden in certain components (e.g. SearchControl, maybe SelectControl).
We don't quite want to surface this as an official prop on public components themselves because they require careful holistic assessment in terms of accessibility. But it's useful to have as a semi-private prop on an internal building block like InputBase.
Testing Instructions
Apply this diff to test
Apply the diff above and see the Storybook for some InputBase-based components, like InputControl or SelectControl.
Screenshots or screencast
This is just an example of what happens when the borderless flag is enabled in an InputBase-based component, in this case SelectControl. Obviously, other design/accessibility considerations need to be taken into account before shipping this in a public component.