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

Tabs Examples: Improve high contrast support and code quality #2194

Merged
merged 52 commits into from
Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4372458
updated reference table
jongund Sep 21, 2021
b05cace
Merge branch 'main' of github.com:w3c/aria-practices
jongund Sep 28, 2021
6044a71
Merge branch 'main' of github.com:w3c/aria-practices
jongund Oct 5, 2021
47041ce
Merge branch 'main' of github.com:w3c/aria-practices
jongund Oct 18, 2021
13351af
Merge branch 'main' of github.com:w3c/aria-practices
jongund Oct 26, 2021
88733e1
Merge branch 'main' of github.com:w3c/aria-practices
jongund Oct 29, 2021
ac426b1
Merge branch 'main' of github.com:w3c/aria-practices
jongund Oct 31, 2021
b613279
Merge branch 'main' of github.com:w3c/aria-practices
jongund Nov 1, 2021
de13911
Merge branch 'main' of github.com:w3c/aria-practices
jongund Nov 8, 2021
7f3dee3
Merge branch 'main' of github.com:w3c/aria-practices
jongund Nov 10, 2021
e18b8bc
Merge branch 'main' of github.com:w3c/aria-practices
jongund Nov 11, 2021
8d6a0ce
updated tabs examples
jongund Jan 4, 2022
57ac4c3
fixed linting bugs
jongund Jan 4, 2022
375d1f1
fixed linting bugs
jongund Jan 4, 2022
a87be74
fixed spelling bugs
jongund Jan 4, 2022
550e0d8
fixed spelling bugs
jongund Jan 5, 2022
03ac019
fixed spelling errors
jongund Jan 5, 2022
f4c08e2
fixed spelling errors
jongund Jan 5, 2022
c2cf64d
fixed file reference errors
jongund Jan 5, 2022
bcbb885
fixed file reference
jongund Jan 5, 2022
9594a09
fixed documentation formatting issue
jongund Jan 5, 2022
93e1f3e
fixed JS naming issue
jongund Jan 5, 2022
d3c1b93
updated regression test for tab order
jongund Jan 5, 2022
12eb7a1
Merge branch 'main' of github.com:w3c/aria-practices
jongund Jan 12, 2022
667ea50
updated examples to show when tabindex=0 should be used on tabpanels
jongund Jan 18, 2022
24725b6
additional editorial changes
jongund Jan 18, 2022
dc9f1f7
Update examples/tabs/tabs-manual.html
jongund Jan 19, 2022
c9c750a
Update examples/tabs/css/tabs.css
jongund Jan 19, 2022
dcd2c36
fixed css formatting issue
jongund Jan 19, 2022
c706d09
updated tablist label to remove word selected
jongund Feb 22, 2022
5b0bdd0
updated accessibility features documentation
jongund Feb 22, 2022
21cd1b2
Merge branch 'main' of github.com:w3c/aria-practices
jongund Feb 28, 2022
c93397a
Merge branch 'main' into tablist-update
jongund Feb 28, 2022
5349cae
Merge branch 'tablist-update' of github.com:w3c/aria-practices into t…
jongund Mar 1, 2022
bd799d4
updated border styling information for selected tab
jongund Mar 1, 2022
868c7bc
updated accessibility feature information
jongund Mar 1, 2022
fa27985
updated tabs to make the active 4pixels higher than the inactive tabs
jongund Mar 1, 2022
98f1143
updated tabs to make the top border 4 pixels wide than the inactive tabs
jongund Mar 1, 2022
a293fcf
fix hrefs in head3er links
mcking65 Mar 2, 2022
31aad89
Fix hrefs in links to main doc
mcking65 Mar 2, 2022
e585306
editorial revisions to accessibility feature documentation
mcking65 Mar 2, 2022
5c142f2
editorial revisions to accessibility feature documentation
mcking65 Mar 2, 2022
6a7cbbc
Change IDREF to ID_REFERENCE and change q tags that are inside code t…
mcking65 Mar 2, 2022
e766039
fix lint error
mcking65 Mar 2, 2022
245e3b3
editorial simplification to accessibility features documentation
mcking65 Mar 2, 2022
dec2e59
editorial revision to states and props documentation
mcking65 Mar 2, 2022
480ee2a
Replace use of should with other phrasing in intro
mcking65 Mar 2, 2022
4b05a53
Editorial revision to intro
mcking65 Mar 2, 2022
3a7c8ee
changed h2 to h3 in example code
jongund Mar 2, 2022
4386436
changed the prefix for event handlers from `handle` to `on` per our J…
jongund Mar 2, 2022
e084e05
updated color of top border of selected tab
jongund Mar 5, 2022
ec80a02
Merge branch 'tablist-update' of github.com:w3c/aria-practices into t…
jongund Mar 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions aria-practices.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Copy link
Contributor

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!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two main issues:

  1. I am not sure it is a a good practice for the APG to reference contemporary musicians, it might be misunderstood as some type of endorsement for those musicians or at least an unfair improvement to their SEO, so I did not feel comfortable using them in the updates I made.
  2. We will be adding at least one more example that will add and delete tabs and this was easier for me to find additional related content for those examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two main issues:

  1. I am not sure it is a a good practice for the APG to reference contemporary musicians, it might be misunderstood as some type of endorsement for those musicians or at least an unfair improvement to their SEO, so I did not feel comfortable using them in the updates I made.
  2. We will be adding at least one more example that will add and delete tabs and this was easier for me to find additional related content for those examples.

Copy link
Contributor

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?

<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>

Expand Down Expand Up @@ -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>
Copy link
Contributor

Choose a reason for hiding this comment

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

or the first element with content is not focusable

What does that mean? Could you please elaborate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There needs to be more clarity when tabindex=0 is put on the element with the tabpanel role. So the modified examples now show one example where the tabindex is on the tabpanel and one that it is not based on the requirements of the first element being focusable in the tabpanel.

</ol>
</section>
<section class="notoc">
Expand All @@ -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>.
Expand Down
11 changes: 11 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"Accesskey",
"activedescendants",
"affordance",
"Ahlefeldt",
"alertdialog",
"Anjou",
"Aristov",
Expand Down Expand Up @@ -74,6 +75,7 @@
"Focusability",
"focusable",
"Foltz",
"Fonseca",
"Foyle",
"Frahm",
"funders",
Expand All @@ -87,6 +89,7 @@
"Gunderson",
"Hassium",
"Hausler",
"Henriette",
"highlighttext",
"Higley",
"Hillen",
Expand All @@ -104,8 +107,10 @@
"jumpto",
"Kasper",
"kbdshortcuts",
"Kiærskou",
"Kowno",
"Labelable",
"Lange",
"Lauke",
"Leventhal",
"Lewandowski",
Expand All @@ -129,6 +134,7 @@
"moreaccessible",
"Moscovium",
"MSAA",
"Müller",
"multithumb",
"navs",
"Nemeth",
Expand Down Expand Up @@ -179,8 +185,10 @@
"Ségur",
"Shirisha",
"shizzle",
"Siboni",
"Shopify",
"Smorgeni",
"Sofie",
"sortability",
"sourcecode",
"Spinbuttons",
Expand All @@ -202,9 +210,11 @@
"textarea's",
"textfield",
"Thaarup",
"Theresia",
"Thiel",
"Thiers",
"thomascorthals",
"Tonekunstnerinde",
"togglable",
"transactinide",
"transuranic",
Expand All @@ -220,6 +230,7 @@
"unmanaged",
"Vasily",
"Vinkle",
"virkelig",
"vnurc",
"Vyacheslav",
"walkability",
Expand Down
26 changes: 12 additions & 14 deletions examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,8 @@ <h2 id="examples_by_role_label">Examples by Role</h2>
<td>
<ul>
<li><a href="carousel/carousel-2-tablist.html">Auto-Rotating Image Carousel with Tabs for Slide Control</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
<li><a href="tabs/tabs-2/tabs.html">Tabs with Manual Activation</a></li>
<li><a href="tabs/tabs-automatic.html">Tabs with Automatic Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-manual.html">Tabs with Manual Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
</ul>
</td>
</tr>
Expand All @@ -393,8 +393,8 @@ <h2 id="examples_by_role_label">Examples by Role</h2>
<td>
<ul>
<li><a href="carousel/carousel-2-tablist.html">Auto-Rotating Image Carousel with Tabs for Slide Control</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
<li><a href="tabs/tabs-2/tabs.html">Tabs with Manual Activation</a></li>
<li><a href="tabs/tabs-automatic.html">Tabs with Automatic Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-manual.html">Tabs with Manual Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
</ul>
</td>
</tr>
Expand All @@ -403,8 +403,8 @@ <h2 id="examples_by_role_label">Examples by Role</h2>
<td>
<ul>
<li><a href="carousel/carousel-2-tablist.html">Auto-Rotating Image Carousel with Tabs for Slide Control</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
<li><a href="tabs/tabs-2/tabs.html">Tabs with Manual Activation</a></li>
<li><a href="tabs/tabs-automatic.html">Tabs with Automatic Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-manual.html">Tabs with Manual Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
</ul>
</td>
</tr>
Expand Down Expand Up @@ -532,8 +532,8 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<li><a href="menu-button/menu-button-actions-active-descendant.html">Actions Menu Button Using aria-activedescendant</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="menu-button/menu-button-actions.html">Actions Menu Button Using element.focus()</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="menu-button/menu-button-links.html">Navigation Menu Button</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
<li><a href="tabs/tabs-2/tabs.html">Tabs with Manual Activation</a></li>
<li><a href="tabs/tabs-automatic.html">Tabs with Automatic Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-manual.html">Tabs with Manual Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="toolbar/toolbar.html">Toolbar</a></li>
</ul>
</td>
Expand Down Expand Up @@ -655,8 +655,6 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<li><a href="slider/slider-multithumb.html">Horizontal Multi-Thumb Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="spinbutton/datepicker-spinbuttons.html">Date Picker Spin Button</a></li>
<li><a href="table/table.html">Table</a></li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
<li><a href="tabs/tabs-2/tabs.html">Tabs with Manual Activation</a></li>
<li><a href="toolbar/toolbar.html">Toolbar</a></li>
<li><a href="treegrid/treegrid-1.html">Treegrid Email Inbox</a></li>
<li><a href="treeview/treeview-navigation.html">Navigation Treeview</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
Expand Down Expand Up @@ -695,8 +693,8 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<li><a href="slider/slider-temperature.html">Vertical Temperature Slider</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="spinbutton/datepicker-spinbuttons.html">Date Picker Spin Button</a></li>
<li><a href="switch/switch-button.html">Switch Using HTML Button</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
<li><a href="tabs/tabs-2/tabs.html">Tabs with Manual Activation</a></li>
<li><a href="tabs/tabs-automatic.html">Tabs with Automatic Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-manual.html">Tabs with Manual Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="treeview/treeview-1/treeview-1a.html">File Directory Treeview Using Computed Properties</a></li>
<li><a href="treeview/treeview-1/treeview-1b.html">File Directory Treeview Using Declared Properties</a></li>
<li><a href="treeview/treeview-navigation.html">Navigation Treeview</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
Expand Down Expand Up @@ -816,8 +814,8 @@ <h2 id="examples_by_props_label">Examples By Properties and States</h2>
<li><a href="listbox/listbox-grouped.html">Listbox with Grouped Options</a></li>
<li><a href="listbox/listbox-rearrangeable.html">Listboxes with Rearrangeable Options</a></li>
<li><a href="listbox/listbox-scrollable.html">Scrollable Listbox</a></li>
<li><a href="tabs/tabs-1/tabs.html">Tabs with Automatic Activation</a></li>
<li><a href="tabs/tabs-2/tabs.html">Tabs with Manual Activation</a></li>
<li><a href="tabs/tabs-automatic.html">Tabs with Automatic Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="tabs/tabs-manual.html">Tabs with Manual Activation</a> (<abbr title="High Contrast Support">HC</abbr>)</li>
<li><a href="treeview/treeview-1/treeview-1a.html">File Directory Treeview Using Computed Properties</a></li>
<li><a href="treeview/treeview-1/treeview-1b.html">File Directory Treeview Using Declared Properties</a></li>
</ul>
Expand Down
108 changes: 36 additions & 72 deletions examples/tabs/css/tabs.css
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;
Copy link
Contributor

Choose a reason for hiding this comment

The 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;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably set a transparent outline.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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%);
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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;
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The visual rendering is not good in windows less than 550 pixels.

Copy link
Contributor

Choose a reason for hiding this comment

The 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;
}
Loading