Repository navigation
Components: replace TabPanel with Tabs in the editor's ColorPanel - #56878
Merged
Merged
Conversation
TabPanel with Tabs in the editor'sColorPanelTabPanel 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
|
27 of 36 tasks
2 tasks done
brookewp
approved these changes
Dec 8, 2023
brookewp
left a comment
Contributor
There was a problem hiding this comment.
This is testing really well in the editor, site editor, and in various browsers. Nice! ✅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Why?
Part of the work outlined in #52997
Adding an
initialTabIdvalue makes this implementation more consistent with theColorPanelusages in the editor, as those already follow this pattern.How?
TabPanelis swapped out forTabsand its sub-components. A small abstraction re-labeling some of the tab data was removed to simplify things. We now need to map through thetabsdata twice, and thetabConfigsabstraction 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:
ColorPanelrenders 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
Colorsstyle settingsColorPanelrenders 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