-
Notifications
You must be signed in to change notification settings - Fork 355
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
Tabs Examples: Improve high contrast support and code quality #2194
Changes from all commits
4372458
b05cace
6044a71
47041ce
13351af
88733e1
ac426b1
b613279
de13911
7f3dee3
e18b8bc
8d6a0ce
57ac4c3
375d1f1
a87be74
550e0d8
03ac019
f4c08e2
c2cf64d
bcbb885
9594a09
93e1f3e
d3c1b93
12eb7a1
667ea50
24725b6
dc9f1f7
c9c750a
dcd2c36
c706d09
5b0bdd0
21cd1b2
c93397a
5349cae
bd799d4
868c7bc
fa27985
98f1143
a293fcf
31aad89
e585306
5c142f2
6a7cbbc
e766039
245e3b3
dec2e59
480ee2a
4b05a53
3a7c8ee
4386436
e084e05
ec80a02
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2772,8 +2772,8 @@ <h3>Tabs</h3> | |
<section class="notoc"> | ||
<h4>Examples</h4> | ||
<ul> | ||
<li><a href="examples/tabs/tabs-1/tabs.html">Tabs With Automatic Activation</a>: A tabs widget where tabs are automatically activated and their panel is displayed when they receive focus.</li> | ||
<li><a href="examples/tabs/tabs-2/tabs.html">Tabs With Manual Activation</a>: A tabs widget where users activate a tab and display its panel by pressing <kbd>Space</kbd> or <kbd>Enter</kbd>.</li> | ||
<li><a href="examples/tabs/tabs-automatic.html">Tabs With Automatic Activation</a>: A tabs widget where tabs are automatically activated and their panel is displayed when they receive focus.</li> | ||
<li><a href="examples/tabs/tabs-manual.html">Tabs With Manual Activation</a>: A tabs widget where users activate a tab and display its panel by pressing <kbd>Space</kbd> or <kbd>Enter</kbd>.</li> | ||
</ul> | ||
</section> | ||
|
||
|
@@ -2835,6 +2835,7 @@ <h4>Keyboard Interaction</h4> | |
</ol> | ||
</li> | ||
<li>If the tab list is horizontal, it does not listen for <kbd>Down Arrow</kbd> or <kbd>Up Arrow</kbd> so those keys can provide their normal browser scrolling functions even when focus is inside the tab list.</li> | ||
<li>When the tabpanel does not contain any focusable elements or the first element with content is not focusable, the tabpanel should set <code>tabindex="0"</code> to include it in the tab sequence of the page.</li> | ||
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.
What does that mean? Could you please elaborate? 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. There needs to be more clarity when |
||
</ol> | ||
</section> | ||
<section class="notoc"> | ||
|
@@ -2849,7 +2850,7 @@ <h4>WAI-ARIA Roles, States, and Properties</h4> | |
</li> | ||
<li>Each element with role <code>tab</code> has the property <a href="#aria-controls" class="property-reference">aria-controls</a> referring to its associated <code>tabpanel</code> element.</li> | ||
<li>The active <code>tab</code> element has the state <a href="#aria-selected" class="state-reference">aria-selected</a> set to <code>true</code> and all other <code>tab</code> elements have it set to <code>false</code>.</li> | ||
<li>Each element with role <code>tabpanel</code> has the property <a href="#aria-labelledby" class="property-reference">aria-labelledby</a> referring to its associated <code>tab</code> element. </li> | ||
<li>Each element with role <code>tabpanel</code> has the property <a href="#aria-labelledby" class="property-reference">aria-labelledby</a> referring to its associated <code>tab</code> element.</li> | ||
<li>If a <code>tab</code> element has a popup menu, it has the property <a href="#aria-haspopup" class="property-reference">aria-haspopup</a> set to either <code>menu</code> or <code>true</code>. </li> | ||
<li> | ||
If the <code>tablist</code> element is vertically oriented, it has the property <a href="#aria-orientation" class="property-reference">aria-orientation</a> set to <code>vertical</code>. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,71 @@ | ||
.tabs { | ||
width: 20em; | ||
font-family: "lucida grande", sans-serif; | ||
} | ||
|
||
[role="tablist"] { | ||
margin: 0 0 -0.1em; | ||
overflow: visible; | ||
min-width: 550px; | ||
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. Why are we setting a min-width? |
||
} | ||
|
||
[role="tab"] { | ||
[role="tab"], | ||
[role="tab"]:focus, | ||
[role="tab"]:hover { | ||
position: relative; | ||
z-index: 2; | ||
top: 2px; | ||
margin: 0; | ||
padding: 0.3em 0.5em 0.4em; | ||
margin-top: 4px; | ||
padding: 3px 3px 4px; | ||
jongund marked this conversation as resolved.
Show resolved
Hide resolved
|
||
border: 1px solid hsl(219deg 1% 72%); | ||
border-radius: 0.2em 0.2em 0 0; | ||
box-shadow: 0 0 0.2em hsl(219deg 1% 72%); | ||
border-bottom: 2px solid hsl(219deg 1% 72%); | ||
border-radius: 5px 5px 0 0; | ||
overflow: visible; | ||
font-family: inherit; | ||
font-size: inherit; | ||
background: hsl(220deg 20% 94%); | ||
} | ||
|
||
[role="tab"]:hover::before, | ||
[role="tab"]:focus::before, | ||
[role="tab"][aria-selected="true"]::before { | ||
position: absolute; | ||
bottom: 100%; | ||
right: -1px; | ||
left: -1px; | ||
border-radius: 0.2em 0.2em 0 0; | ||
border-top: 3px solid hsl(20deg 96% 48%); | ||
content: ""; | ||
outline: none; | ||
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. We should probably set a transparent outline. 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. The updated examples are actively styling keyboard focus, so it will be visually confusing if outline also appears. We do not want two focus rings. |
||
font-weight: bold; | ||
} | ||
|
||
[role="tab"][aria-selected="true"] { | ||
border-radius: 0; | ||
padding: 2px 2px 4px; | ||
margin-top: 0; | ||
border-width: 2px; | ||
border-top-width: 6px; | ||
border-top-color: rgb(36 116 214); | ||
border-bottom-color: hsl(220deg 43% 99%); | ||
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. I don't understand any of these CSS changes? They don't seem to relate to the requested changes? 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. To support high contrast modes I am trying to emphasize at least 2 pixel spacing and borders to support operating system high contrast modes for focus styling. This is easier for developers to see if pixels are used in the code. 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. Ah I see what you’re saying now. But wouldn’t a transparent outline achieve the same for high contrast mode? Would’ve been a far less invasive change. |
||
background: hsl(220deg 43% 99%); | ||
outline: 0; | ||
} | ||
|
||
jongund marked this conversation as resolved.
Show resolved
Hide resolved
|
||
[role="tab"][aria-selected="true"]:not(:focus):not(:hover)::before { | ||
border-top: 5px solid hsl(218deg 96% 48%); | ||
[role="tab"][aria-selected="false"] { | ||
border-bottom: 1px solid hsl(219deg 1% 72%); | ||
} | ||
|
||
[role="tab"][aria-selected="true"]::after { | ||
position: absolute; | ||
z-index: 3; | ||
bottom: -1px; | ||
right: 0; | ||
left: 0; | ||
height: 0.3em; | ||
background: hsl(220deg 43% 99%); | ||
box-shadow: none; | ||
content: ""; | ||
} | ||
|
||
[role="tab"]:hover, | ||
[role="tab"]:focus, | ||
[role="tab"]:active { | ||
outline: 0; | ||
border-radius: 0; | ||
color: inherit; | ||
[role="tab"] span.focus { | ||
display: inline-block; | ||
margin: 2px; | ||
padding: 4px 6px; | ||
} | ||
|
||
[role="tab"]:hover::before, | ||
[role="tab"]:focus::before { | ||
border-color: hsl(20deg 96% 48%); | ||
[role="tab"]:hover span.focus, | ||
[role="tab"]:focus span.focus, | ||
[role="tab"]:active span.focus { | ||
padding: 2px 4px; | ||
border: 2px solid rgb(36 116 214); | ||
border-radius: 3px; | ||
} | ||
|
||
[role="tabpanel"] { | ||
position: relative; | ||
z-index: 2; | ||
padding: 0.5em 0.5em 0.7em; | ||
border: 1px solid hsl(219deg 1% 72%); | ||
border-radius: 0 0.2em 0.2em; | ||
box-shadow: 0 0 0.2em hsl(219deg 1% 72%); | ||
padding: 5px; | ||
border: 2px solid hsl(219deg 1% 72%); | ||
border-radius: 0 5px 5px; | ||
background: hsl(220deg 43% 99%); | ||
min-height: 10em; | ||
min-width: 550px; | ||
overflow: auto; | ||
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. Same here, I don't understand why these changes are needed. Can you elaborate? 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. The visual rendering is not good in windows less than 550 pixels. 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. Is this related to the content change? Can you elaborate? |
||
} | ||
|
||
[role="tabpanel"].is-hidden { | ||
display: none; | ||
} | ||
|
||
[role="tabpanel"]:focus { | ||
border-color: hsl(20deg 96% 48%); | ||
box-shadow: 0 0 0.2em hsl(20deg 96% 48%); | ||
outline: 0; | ||
} | ||
|
||
[role="tabpanel"]:focus::after { | ||
position: absolute; | ||
bottom: 0; | ||
right: -1px; | ||
left: -1px; | ||
border-bottom: 3px solid hsl(20deg 96% 48%); | ||
border-radius: 0 0 0.2em 0.2em; | ||
content: ""; | ||
} | ||
|
||
[role="tabpanel"] p { | ||
margin: 0; | ||
} | ||
|
||
[role="tabpanel"] * + p { | ||
margin-top: 1em; | ||
} |
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 lot clearer, nice!
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.
Two main issues:
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.
Two main issues:
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.
Should we also update the carousel example to remove all references to the TV shows?