Skip to content
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

Updating TabPanel #42320

Open
jameskoster opened this issue Jul 11, 2022 · 8 comments
Open

Updating TabPanel #42320

jameskoster opened this issue Jul 11, 2022 · 8 comments
Assignees
Labels
Design System Issues related to the system of combining components according to best practices. Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Comments

@jameskoster
Copy link
Contributor

jameskoster commented Jul 11, 2022

Now that TabPanel usage is on the verge of becoming a little more widespead across the Editor (see #38277 (comment) and #41937), it's a good time to consider some aspects of the component design:

Screenshot 2022-07-11 at 10 38 41

TabPanel on Storybook.

Additional to the examples listed above, the most prominent instances of this component paint a border beneath the tabs:

Inserter Inspector
Screenshot 2022-07-11 at 10 41 06 Screenshot 2022-07-11 at 10 41 15

However, the default styling of the component does not include this border. Adding this same style manually across multiple instances is obviously not ideal.

With these new applications we also find situations where Tabs exist within the panels of other Tabs, and in other panels like the color picker. So a question arises about whether there should be a style variant that resembles hierarchy.

Lastly we might consider the layout as well. In particular; should tabs fill their container horizontally? How can we make the panel padding elegantly match the parent container padding, or should the panel padding always be static?

TLDR:

It would be nice if we can avoid ad hoc style overrides when using TabPanel.

  • Should there be a border beneath the tabs as a default?
  • Should tabs fill their container horizontally, ignoring padding?
  • Should tab panel padding be static, or be context aware so that it can match its parent?
  • Should there be a style variant for TabPanels nested within TabPanels, IE secondary tabs? If so, when exactly should this be applied, and can it be handled programatically?

cc @WordPress/gutenberg-design

@jameskoster jameskoster added Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Package] Components /packages/components labels Jul 11, 2022
@jameskoster
Copy link
Contributor Author

Another consideration; when a tab panel is the first child in an element that has padding it can look a little strange:

Screenshot 2022-07-25 at 10 14 39

It would be good to explore options whereby the tabpanel position can be offset without affecting the targetable area.

@jameskoster
Copy link
Contributor Author

I think we can use the designs from #41904 (comment) here.

And to answer my own questions in the OP:

Should there be a border beneath the tabs as a default?

I think so. Given the active indicator we use the tab UI looks a bit unfinished without it. We'll need to update current implementations where the border is added ad hoc (Inspector and Inserter).

Should tabs fill their container horizontally, ignoring padding?

It would be nice if there was a way to do this in a context-aware manner, but I appreciate that might be difficult. Alternatively perhaps we can make it possible to pass a spacing preset to the tabpanel and use that as an offset (negative margin).

Should tab panel padding be static, or be context aware so that it can match its parent?

We might do something similar to the previous point – if the tabpanel margin is offset, offer a way to add the offset to the padding.

Should there be a style variant for TabPanels nested within TabPanels, IE secondary tabs? If so, when exactly should this be applied, and can it be handled programatically?

Tabs within tabs are uncommon (not sure we have any instances of this in the UI currently), so we probably don't need to prioritise this.

@t-hamano
Copy link
Contributor

This may be edge cases, but I'll mention #33108 because it may be a good idea to consider cases where the tab panel has long text.

@miminari
Copy link
Member

That's a good consideration, thanks.
I would be happy to discuss the newly added Setting / Styles tab at the same time.

Double-tabbing is also a problem, but I am concerned that in the case of a block with many items, there is a high possibility that users will not be able to see the tabs when loading the page and will get lost in the operation. At least I was lost in the operation even though I knew it was tabbed.

Perhaps it would be better to be fixed at the top when scrolled.

@mirka
Copy link
Member

mirka commented Mar 14, 2023

I would be happy to discuss the newly added Setting / Styles tab at the same time.

Perhaps it would be better to be fixed at the top when scrolled.

Since tablists aren't really designed to be stacked vertically, we should ideally reconsider whether it's a good idea to nest tabs in the first place. Has this problem been discussed before, @jameskoster?

stacked tablists

Another way around it could be to make the nested tabpanel a separate scrolling container, but that's probably not a silver bullet either:

tabpanel of the nested tab

@jameskoster
Copy link
Contributor Author

Making the settings/appearance tabs sticky is worth exploring, similar to blocks/patterns/media in the Inserter. I don't know that it needs to be a specific prop on the component though, it feels like something to be treated more contextually.

I agree that visually stacked tablists look a bit awkward. I haven't seen any explorations around how to address that yet.

@miminari
Copy link
Member

Thank you for considering my opinion.
As the number of things that can be done increases, it is inevitable that the UI will become more complex. Personally, I feel that the UI is becoming more and more similar to Figma.

However, I would like to avoid the fact that the functions are buried and users do not notice them.
It may be desirable to consider such complex UI design on Figma.

@jameskoster
Copy link
Contributor Author

Another way around it could be to make the nested tabpanel a separate scrolling container, but that's probably not a silver bullet either

I misread this to mean individually scrolling sections within the container. But if the container itself scrolled that might work. It's worth a try imo.

@jordesign jordesign added the [Type] Enhancement A suggestion for improvement. label Sep 5, 2023
@jasmussen jasmussen added the Design System Issues related to the system of combining components according to best practices. label Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design System Issues related to the system of combining components according to best practices. Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

6 participants