For discussion: Allow tabs to work on mobile#1825
Draft
frankieroberto wants to merge 1 commit intomainfrom
Draft
For discussion: Allow tabs to work on mobile#1825frankieroberto wants to merge 1 commit intomainfrom
frankieroberto wants to merge 1 commit intomainfrom
Conversation
Contributor
Author
|
Follow-up thought: could the tab behaviour work with pure CSS nowadays? (eg using the |
|
some random lunchtime thoughts:
|
Contributor
|
We could make it optional and more of an editorial decision, like with responsive tables. The designer can decide to allow it to be tabbed or stacked on mobile, depending on the content and labels. I suppose even with this, we'll need to make it not totally broken on mobile though… |
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.
Currently the way our Tabs component is set up mirrors the way the GOV.UK Tabs work.
That is, if JavaScript is unavailable OR you’re on a viewport below 641 pixels wide (mostly a mobile, or split-screen on a tablet or laptop), then you don’t see the visual tabs at all but instead see a "Contents" list of links, which are then anchor-linked to plain headings further down the page.
This is great from a progressive enhancement point of view for the no-JavaScript option, but can be unexpected on a mobile, where users might lose the ability to quick switch between tabs, and also face quite a long page.
One additional consideration is that in the GOVUK design system, both the tab panel background and the general page background is white. However in the NHS design system, the general page background is light grey but the tab panel background is white - so this means remembering to design the tab content to work on both background colours.
We could instead change the component so that the tab behaviour is also available on mobile sized screens. This would be particularly advantageous where the tabs are short enough to fit.
Screenshots
What if they don’t fit?
The tricky bit is deciding what to do if the tabs don’t fit in a single row on your mobile-sized screen, either because you’ve got too many of them or the labels are too long.
Without any further modification, this looks broken:
Possible solutions: