-
Notifications
You must be signed in to change notification settings - Fork 86
experiment: add tabs base styles and visual tests #9481
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
Open
jouni
wants to merge
13
commits into
main
Choose a base branch
from
experiment/base-tabs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4b5dd58
base styles for tabs
jouni 4a4f8d7
Reuse padding property instead of introducing a new one
jouni e4711bc
format tabs.html
jouni 9d53fbf
support anchors within tabs
jouni 8b9e7ed
add visual tests for base styles
jouni 8413e10
Merge remote-tracking branch 'origin/main' into experiment/base-tabs
vursen 0366c8d
Merge remote-tracking branch 'origin/main' into experiment/base-tabs
vursen c58fc55
Update tabs.html
jouni 1180d2a
fix vertical orientation tab sizing and label alignment
jouni 989fc5b
fix scroll button sizing
jouni 8412895
Update vaadin-tabs-base-styles.js
jouni 757d3f3
Merge branch 'main' into experiment/base-tabs
jouni f816e3c
test: update tabs visual references
DiegoCardoso 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 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2025 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import type { CSSResult } from 'lit'; | ||
|
||
export const tabStyles: CSSResult; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2025 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import '@vaadin/component-base/src/style-props.js'; | ||
import { css } from 'lit'; | ||
|
||
export const tabStyles = css` | ||
@layer base { | ||
:host { | ||
flex-shrink: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
gap: var(--vaadin-tab-gap, var(--_vaadin-gap-container-inline)); | ||
padding: var(--vaadin-tab-padding, var(--_vaadin-padding-container)); | ||
cursor: var(--vaadin-clickable-cursor); | ||
font-size: var(--vaadin-tab-font-size, 1em); | ||
font-weight: var(--vaadin-tab-font-weight, 500); | ||
line-height: var(--vaadin-tab-line-height, inherit); | ||
color: var(--vaadin-tab-color, inherit); | ||
background: var(--vaadin-tab-background, transparent); | ||
border-radius: var(--vaadin-tab-border-radius, var(--_vaadin-radius-m)); | ||
-webkit-tap-highlight-color: transparent; | ||
-webkit-user-select: none; | ||
user-select: none; | ||
touch-action: manipulation; | ||
position: relative; | ||
} | ||
|
||
:host([hidden]) { | ||
display: none !important; | ||
} | ||
|
||
:host([orientation='vertical']) { | ||
justify-content: start; | ||
} | ||
|
||
:host([selected]) { | ||
--vaadin-tab-background: var(--_vaadin-background-container); | ||
--vaadin-tab-color: var(--_vaadin-color-strong); | ||
} | ||
|
||
:host([disabled]) { | ||
cursor: var(--vaadin-disabled-cursor); | ||
opacity: 0.5; | ||
} | ||
|
||
:host(:is([focus-ring], :focus-visible)) { | ||
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color); | ||
outline-offset: calc(var(--vaadin-focus-ring-width) * -1); | ||
} | ||
|
||
slot { | ||
gap: inherit; | ||
align-items: inherit; | ||
justify-content: inherit; | ||
} | ||
|
||
::slotted(a) { | ||
color: inherit; | ||
cursor: inherit; | ||
text-decoration: inherit; | ||
display: flex; | ||
align-items: inherit; | ||
justify-content: inherit; | ||
gap: inherit; | ||
} | ||
|
||
::slotted(a)::before { | ||
content: ''; | ||
position: absolute; | ||
inset: 0; | ||
} | ||
|
||
@media (forced-colors: active) { | ||
:host { | ||
border: 1px solid Canvas; | ||
} | ||
|
||
:host([selected]) { | ||
color: Highlight; | ||
border-color: Highlight; | ||
} | ||
|
||
:host([disabled]) { | ||
color: GrayText; | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
`; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2025 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import type { CSSResult } from 'lit'; | ||
|
||
export const tabsStyles: CSSResult; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2025 - 2025 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import '@vaadin/component-base/src/style-props.js'; | ||
import { css } from 'lit'; | ||
|
||
export const tabsStyles = css` | ||
@layer base { | ||
:host { | ||
display: flex; | ||
max-width: 100%; | ||
max-height: 100%; | ||
position: relative; | ||
} | ||
|
||
:host([hidden]) { | ||
display: none !important; | ||
} | ||
|
||
:host([orientation='vertical']) { | ||
flex-direction: column; | ||
} | ||
|
||
[part='tabs'] { | ||
flex: 1; | ||
overflow: auto; | ||
overscroll-behavior: contain; | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--vaadin-tabs-gap, var(--_vaadin-gap-container-inline)); | ||
} | ||
|
||
:host([orientation='horizontal']) [part='tabs'] { | ||
flex-direction: row; | ||
scrollbar-width: none; | ||
} | ||
|
||
/* scrollbar-width is supported in Safari 18.2, use the following for earlier */ | ||
:host([orientation='horizontal']) [part='tabs']::-webkit-scrollbar { | ||
display: none; | ||
} | ||
|
||
[part='back-button'], | ||
[part='forward-button'] { | ||
position: absolute; | ||
z-index: 1; | ||
pointer-events: none; | ||
opacity: 0; | ||
cursor: var(--vaadin-clickable-cursor); | ||
box-sizing: border-box; | ||
height: 100%; | ||
padding: var(--vaadin-tab-padding, var(--_vaadin-padding-container)); | ||
background: var(--_vaadin-background); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
-webkit-tap-highlight-color: transparent; | ||
touch-action: manipulation; | ||
} | ||
|
||
[part='forward-button'] { | ||
inset-inline-end: 0; | ||
} | ||
|
||
:host([overflow~='start']) [part='back-button'], | ||
:host([overflow~='end']) [part='forward-button'] { | ||
pointer-events: auto; | ||
opacity: 1; | ||
} | ||
|
||
:is([part='back-button'], [part='forward-button'])::before { | ||
content: ''; | ||
display: block; | ||
width: var(--vaadin-icon-size, 1lh); | ||
height: var(--vaadin-icon-size, 1lh); | ||
background: currentColor; | ||
mask-image: var(--_vaadin-icon-chevron-down); | ||
rotate: 90deg; | ||
} | ||
|
||
[part='forward-button']::before { | ||
rotate: -90deg; | ||
} | ||
|
||
:host(:is([orientation='vertical'], [theme~='hide-scroll-buttons'])) | ||
:is([part='back-button'], [part='forward-button']) { | ||
display: none; | ||
} | ||
|
||
@media (pointer: coarse) { | ||
:host(:not([theme~='show-scroll-buttons'])) :is([part='back-button'], [part='forward-button']) { | ||
display: none; | ||
} | ||
} | ||
|
||
:host([dir='rtl']) :is([part='back-button'], [part='forward-button'])::before { | ||
scale: 1 -1; | ||
} | ||
|
||
@media (forced-colors: active) { | ||
:is([part='back-button'], [part='forward-button'])::before { | ||
background: CanvasText; | ||
} | ||
} | ||
} | ||
`; |
Binary file added
BIN
+1.21 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/anchors-horizontal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.81 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/anchors-vertical.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.34 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-horizontal-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.35 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-horizontal-middle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.38 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-horizontal-scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.21 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-horizontal-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.81 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-vertical-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.82 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-vertical-middle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.24 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-vertical-scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.83 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/ltr-vertical-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.33 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-horizontal-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.34 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-horizontal-middle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.4 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-horizontal-scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.16 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-horizontal-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.78 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-vertical-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-vertical-middle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.25 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-vertical-scroll.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 KB
packages/tabs/test/visual/base/screenshots/tabs/baseline/rtl-vertical-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Uh oh!
There was an error while loading. Please reload this page.