-
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
Use TabPanel in edit settings sidebar header (#13587) #16663
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2f5414b
Use TabPanel in edit settings sidebar header (#13587)
jffng a9124b9
Toggle active states when block is selected
jffng bcf46a3
Refactor TabPanel with useState and useEffect
jffng cff31f0
Backwards compatibility for initialTabName prop
jffng 8733d7d
Don't render the tab panel content container unless there's content
jffng 0686044
Simplify settings header and tab panel logic
jffng 84ab486
Differ aria-label selected text to TabPanel
jffng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
.components-tab-panel__tabs { | ||
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. @mapk are we fine with these styles to be the default look outside of the context of sidebar and WordPress in general? |
||
display: flex; | ||
align-items: stretch; | ||
background: $light-gray-200; | ||
border-bottom: 1px solid #e2e4e7; | ||
} | ||
|
||
.components-tab-panel__tabs-item { | ||
background: transparent; | ||
border: none; | ||
box-shadow: none; | ||
cursor: pointer; | ||
height: 50px; | ||
line-height: 42px; | ||
padding: 3px 15px; // Use padding to offset the is-active border, this benefits Windows High Contrast mode | ||
margin-left: 0; | ||
font-weight: 400; | ||
@include square-style__neutral; | ||
transition: box-shadow 0.1s linear; | ||
|
||
&:focus:enabled { | ||
color: $dark-gray-900; | ||
outline-offset: -1px; | ||
outline: 1px dotted $dark-gray-500; | ||
} | ||
|
||
&:focus:enabled, | ||
&.is-active { | ||
box-shadow: inset 0 -3px theme(outlines); | ||
font-weight: 600; | ||
position: relative; | ||
background: transparent; | ||
|
||
// This border appears in Windows High Contrast mode instead of the box-shadow. | ||
&::before { | ||
content: ""; | ||
position: absolute; | ||
top: 0; | ||
bottom: 1px; | ||
right: 0; | ||
left: 0; | ||
border-bottom: 3px solid transparent; | ||
} | ||
} | ||
|
||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
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.
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 a breaking change and can't be landed as is. It needs to provide a way which ensures that this code is backward compatible with a solid deprecation strategy which informs developers that there is a new way to handle this prop.
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 review @gziolo, noted.
I added support for the
initialTabName
for backwards compatibility, as well deprecation notes in the README. However, I lack context as to the timing / version to officially deprecate this prop.This is also assuming that having a prop to control the active tab from a parent component is a good idea / not an anti-pattern.
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.
If we don't want to keep this param, we should rather remove it from docs and ensure that when used it works as close as possible as the new one.