-
Notifications
You must be signed in to change notification settings - Fork 4.7k
[Components] Update FontSize control #35395
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
Changes from 12 commits
f0732b4
b96d06d
13c98e5
9b2e02d
e7c292e
e666227
b82385d
4c3b875
fe2e844
0961ee0
e123e7a
6be9517
4ed3f06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ import { __, sprintf } from '@wordpress/i18n'; | |
| */ | ||
| import { Button, VisuallyHidden } from '../'; | ||
|
|
||
| const itemToString = ( item ) => item && item.name; | ||
| const itemToString = ( item ) => item?.name; | ||
| // This is needed so that in Windows, where | ||
| // the menu does not necessarily open on | ||
| // key up/down, you can still switch between | ||
|
|
@@ -98,14 +98,9 @@ export default function CustomSelectControl( { | |
| className: 'components-custom-select-control__menu', | ||
| 'aria-hidden': ! isOpen, | ||
| } ); | ||
| // We need this here, because the null active descendant is not | ||
| // fully ARIA compliant. | ||
| // We need this here, because the null active descendant is not fully ARIA compliant. | ||
| if ( | ||
| menuProps[ 'aria-activedescendant' ] && | ||
| menuProps[ 'aria-activedescendant' ].slice( | ||
| 0, | ||
| 'downshift-null'.length | ||
| ) === 'downshift-null' | ||
| menuProps[ 'aria-activedescendant' ]?.startsWith( 'downshift-null' ) | ||
| ) { | ||
| delete menuProps[ 'aria-activedescendant' ]; | ||
| } | ||
|
|
@@ -161,12 +156,18 @@ export default function CustomSelectControl( { | |
| { | ||
| 'is-highlighted': | ||
| index === highlightedIndex, | ||
| 'has-hint': !! item.hint, | ||
| } | ||
| ), | ||
| style: item.style, | ||
| } ) } | ||
| > | ||
| { item.name } | ||
| { item.hint && ( | ||
| <span className="components-custom-select-control__item-hint"> | ||
| { item.hint } | ||
| </span> | ||
| ) } | ||
|
Comment on lines
+166
to
+170
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better to split changes to The current PR will keep focusing on the Separately from this, I also wonder if we should rewrite the |
||
| { item === selectedItem && ( | ||
| <Icon | ||
| icon={ check } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,19 +58,25 @@ | |
|
|
||
| .components-custom-select-control__item { | ||
| align-items: center; | ||
| display: flex; | ||
| display: grid; | ||
| grid-template-columns: auto auto; | ||
| list-style-type: none; | ||
| padding: $grid-unit-10; | ||
| cursor: default; | ||
| line-height: $icon-size + $grid-unit-05; | ||
|
|
||
|
|
||
| &.has-hint { | ||
| grid-template-columns: auto auto 30px; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we handle this better? 🤔 --cc @jasmussen
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you considered using the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you expand on what I should look for here? Happy to help if I can.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I mean was to refactor this component to use internally the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to make the minimum changes in CustomSelectControl and I'm not sure there are some better rules I should use - or even maybe |
||
| } | ||
| &.is-highlighted { | ||
| background: $gray-300; | ||
| } | ||
|
|
||
| .components-custom-select-control__item-hint { | ||
| font-weight: 200; | ||
| text-align: right; | ||
| padding-right: $grid-unit-05; | ||
| } | ||
| .components-custom-select-control__item-icon { | ||
| margin-right: 0; | ||
| margin-left: auto; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.