Skip to content

feat(#3407): add prop to tabs to not stack on mobile, and skip focus on initial load#3408

Merged
chrisolsen merged 1 commit into
devfrom
tom/tabs-fixes
Feb 24, 2026
Merged

feat(#3407): add prop to tabs to not stack on mobile, and skip focus on initial load#3408
chrisolsen merged 1 commit into
devfrom
tom/tabs-fixes

Conversation

@twjeffery
Copy link
Copy Markdown
Collaborator

Summary

  • Add stackOnMobile prop to keep default tabs horizontal on mobile
  • Skip focus on initial page load to avoid visible focus ring when initialTab is set
  • Remove tabpanel from tab order for segmented variant (tabindex=-1)
  • Remove focus outline on segmented tabpanel (no content to focus)

Test plan

  • Run playground: npm run serve:prs:react → navigate to "V2 Tabs" in features
  • Test 1: Reload page - no focus ring on "Second (initial)" tab
  • Test 2: Default tabs stack on mobile (resize browser)
  • Test 3: Default tabs with stackOnMobile={false} stay horizontal on mobile
  • Test 4: Segmented tabs have no tabpanel focus when tabbing
  • Test 5: Segmented tabs stay horizontal on mobile by default

Closes

Closes #3407
Closes #2996
Closes #3268

@twjeffery twjeffery changed the title feat(#3407): add stackOnMobile prop and fix segmented tabpanel focus feat(#3407): add prop to tabs to not stack on mobile, and skip focus on initial load Feb 9, 2026
Comment thread libs/react-components/src/experimental/tabs/tabs.tsx Outdated
Comment thread libs/react-components/src/lib/tabs/tabs.tsx Outdated
@vanessatran-ddi vanessatran-ddi marked this pull request as draft February 13, 2026 01:03
@vanessatran-ddi vanessatran-ddi force-pushed the tom/tabs-fixes branch 2 times, most recently from 779be6d to 5b1bc51 Compare February 17, 2026 17:51
@vanessatran-ddi vanessatran-ddi marked this pull request as ready for review February 17, 2026 18:14
@vanessatran-ddi vanessatran-ddi self-requested a review February 17, 2026 18:15
customElement={{
tag: "goa-tabs",
props: {
stackOnMobile: { attribute: "stack-on-mobile", type: "String" },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a boolean type

Comment thread libs/web-components/src/components/tabs/Tabs.svelte
/** Visual style variant. "segmented" shows pill-style tabs with animation. */
export let variant: "default" | "segmented" = "default";
/** When true, tabs stack vertically on mobile. Set to "false" to keep horizontal layout on all screen sizes. */
export let stackOnMobile: string = "true";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure a prop name like this is the best idea. It comes off like a hack to make something work.

Instead I would suggest something like orientation that accepts values of auto | horizontal | vertical. auto would be the default value that changes the orientation to vertical for mobile devices (current state). Setting it to horizontal would provide the functionality that this PR intended, and vertical would allow teams to use vertical tabs if the so desire (in the case that there are too many that don't fit horizontally on a normal desktop)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea - I've already refactored stackOnMobile to orientation: auto | horizontal in this PR.

Comment thread libs/web-components/src/components/tabs/Tabs.svelte Outdated
Comment thread libs/angular-components/src/experimental/tabs/tabs.ts Outdated
Comment thread libs/react-components/specs/tabs.browser.spec.tsx
Comment thread libs/react-components/specs/tabs.browser.spec.tsx
Comment thread libs/web-components/src/components/tabs/Tabs.svelte Outdated
@netlify
Copy link
Copy Markdown

netlify Bot commented Feb 18, 2026

Deploy Preview for goa-design-2 ready!

Name Link
🔨 Latest commit 319008f
🔍 Latest deploy log https://app.netlify.com/projects/goa-design-2/deploys/699e142de766ec000876d4e2
😎 Deploy Preview https://deploy-preview-3408--goa-design-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vanessatran-ddi vanessatran-ddi force-pushed the tom/tabs-fixes branch 2 times, most recently from 885e102 to a23fa2d Compare February 18, 2026 17:34
Comment thread docs/src/data/configurations/tabs.ts Outdated
Comment thread docs/src/data/configurations/tabs.ts Outdated
/** Visual style variant. "segmented" shows pill-style tabs with animation. */
export let variant: "default" | "segmented" = "default";
/** Tab layout orientation. "auto" stacks vertically on mobile, "horizontal" keeps horizontal on all screen sizes. */
export let orientation: string = "auto";
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity instead of string, use "auto" | "horizontal"

@chrisolsen
Copy link
Copy Markdown
Collaborator

@vanessatran-ddi looks like you need to rebase. Let me know via slack when you push it.

Co-Authored-By: Vanessa Tran <vanessa.m.tran@gov.ab.ca>
@chrisolsen chrisolsen merged commit 82022fa into dev Feb 24, 2026
8 checks passed
@chrisolsen chrisolsen deleted the tom/tabs-fixes branch February 24, 2026 21:39
@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.41.0-dev.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.11.0-dev.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 6.11.0-dev.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 4.11.0-dev.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 7.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 5.0.0-next.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen chrisolsen added the released Released into production. label Apr 1, 2026
@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 7.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sometimes tabs should not stack on mobile Tabs: "Focus" state pops up on initial load If initialTab is used for GoabTabs - focus is placed on tab

4 participants