-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Components: replace TabPanel
with Tabs
in the editor's ColorPanel
#56878
Conversation
TabPanel
with Tabs
in the editor'sColorPanel
TabPanel
with Tabs
in the editor's ColorPanel
Size Change: +16 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
Flaky tests detected in 1ae5a63. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7133719252
|
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 testing really well in the editor, site editor, and in various browsers. Nice! ✅
What?
Why?
Part of the work outlined in #52997
Adding an
initialTabId
value makes this implementation more consistent with theColorPanel
usages in the editor, as those already follow this pattern.How?
TabPanel
is swapped out forTabs
and its sub-components. A small abstraction re-labeling some of the tab data was removed to simplify things. We now need to map through thetabs
data twice, and thetabConfigs
abstraction didn't work for both of them.For the initial tab selection, the component now checks to confirm that a given tab has a value and selects that tab.
Note: How exactly this manifests depends a bit on how the tabs are being used. For example:
With background colors, the Solid and Gradient tabs are mutually exclusive, and one will always cancel the other out. It behaves like a toggle, so whatever tab you used last is the only one with a value, so it opens automatically.
With something like Button colors in the Site Editor, there are three tabs:
In this case, the Text tab is an independent value. Background and Gradient are once again behaving as a toggle, one always resetting the other. Text being a different setting will retain its own value even when one of the other tabs is used.
This means, if a custom Text color is set, that's the tab the user will get, regardless of what kind of custom background is in effect. There are two tabs with a defined value, and Text is just the first one in this instance. If Text isn't set (or gets cleared) the appropriate button background tab will open as expected.
Side note: that all has me feeling a little weird about some of this UI, but I won't clutter up this PR with my thoughts on that!
Testing Instructions
Post/Page editor:
ColorPanel
renders the correct content based on the current selection. If you set a gradient, that tab should open automatically next time you open theColorPanel
.Site editor
Colors
style settingsColorPanel
renders the correct content based on the current selection. If you set a gradient, that tab should open automatically next time you open theColorPanel
.Keyboard Testing Instructions