Skip to content

Commit

Permalink
Add example of select-only combobox (pull w3c#1396)
Browse files Browse the repository at this point in the history
Resolves issue w3c#1026 by adding a new select-only combobox example.

Co-authored-by: Valerie Young <valerie@bocoup.com>
Co-authored-by: Matt King <a11yThinker@gmail.com>
Co-authored-by: Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com>
  • Loading branch information
4 people authored and maschad96 committed Jul 20, 2020
1 parent ce04c0c commit 4674776
Show file tree
Hide file tree
Showing 17 changed files with 1,461 additions and 38 deletions.
1 change: 1 addition & 0 deletions aria-practices.html
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ <h3>Combobox</h3>
<section class="notoc">
<h4>Examples</h4>
<ul>
<li><a href="examples/combobox/combobox-select-only.html">Select-Only Combobox</a>: A single-select combobox with no text input that is functionally similar to an HTML <code>select</code> element.</li>
<li><a href="examples/combobox/combobox-autocomplete-both.html">Editable Combobox with Both List and Inline Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with inline autocomplete</q>.</li>
<li><a href="examples/combobox/combobox-autocomplete-list.html">Editable Combobox with List Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with manual selection</q>.</li>
<li><a href="examples/combobox/combobox-autocomplete-none.html">Editable Combobox Without Autocomplete</a>: An editable combobox that demonstrates the behavior associated with <code>aria-autocomplete=none</code>.</li>
Expand Down
1 change: 1 addition & 0 deletions examples/combobox/combobox-autocomplete-both.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h1>Editable Combobox With Both List and Inline Autocomplete Example</h1>
</p>
<p>Similar examples include:</p>
<ul>
<li><a href="examples/combobox/combobox-select-only.html">Select-Only Combobox</a>: A single-select combobox with no text input that is functionally similar to an HTML <code>select</code> element.</li>
<li><a href="combobox-autocomplete-list.html">Editable Combobox with List Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with manual selection</q>.</li>
<li><a href="combobox-autocomplete-none.html">Editable Combobox Without Autocomplete</a>: An editable combobox that demonstrates the behavior associated with <code>aria-autocomplete=none</code>.</li>
<li><a href="grid-combo.html">Editable Combobox with Grid Popup</a>: An editable combobox that presents suggestions in a grid, enabling users to navigate descriptive information about each suggestion.</li>
Expand Down
1 change: 1 addition & 0 deletions examples/combobox/combobox-autocomplete-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ <h1>Editable Combobox With List Autocomplete Example</h1>
</p>
<p>Similar examples include:</p>
<ul>
<li><a href="examples/combobox/combobox-select-only.html">Select-Only Combobox</a>: A single-select combobox with no text input that is functionally similar to an HTML <code>select</code> element.</li>
<li><a href="combobox-autocomplete-both.html">Editable Combobox with Both List and Inline Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with inline autocomplete</q>.</li>
<li><a href="combobox-autocomplete-none.html">Editable Combobox Without Autocomplete</a>: An editable combobox that demonstrates the behavior associated with <code>aria-autocomplete=none</code>.</li>
<li><a href="grid-combo.html">Editable Combobox with Grid Popup</a>: An editable combobox that presents suggestions in a grid, enabling users to navigate descriptive information about each suggestion.</li>
Expand Down
1 change: 1 addition & 0 deletions examples/combobox/combobox-autocomplete-none.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ <h1>Editable Combobox without Autocomplete Example</h1>
</p>
<p>Similar examples include: </p>
<ul>
<li><a href="examples/combobox/combobox-select-only.html">Select-Only Combobox</a>: A single-select combobox with no text input that is functionally similar to an HTML <code>select</code> element.</li>
<li><a href="combobox-autocomplete-both.html">Editable Combobox with Both List and Inline Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with inline autocomplete</q>.</li>
<li><a href="combobox-autocomplete-list.html">Editable Combobox with List Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with manual selection</q>.</li>
<li><a href="grid-combo.html">Editable Combobox with Grid Popup</a>: An editable combobox that presents suggestions in a grid, enabling users to navigate descriptive information about each suggestion.</li>
Expand Down
417 changes: 417 additions & 0 deletions examples/combobox/combobox-select-only.html

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions examples/combobox/css/select-only.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.combo *,
.combo *::before,
.combo *::after {
box-sizing: border-box;
}

.combo {
display: block;
margin-bottom: 1.5em;
max-width: 400px;
position: relative;
}

.combo::after {
border-bottom: 2px solid rgba(0, 0, 0, 0.75);
border-right: 2px solid rgba(0, 0, 0, 0.75);
content: '';
display: block;
height: 12px;
pointer-events: none;
position: absolute;
right: 16px;
top: 50%;
transform: translate(0, -65%) rotate(45deg);
width: 12px;
}

.combo-input {
background-color: #f5f5f5;
border: 2px solid rgba(0, 0, 0, 0.75);
border-radius: 4px;
display: block;
font-size: 1em;
min-height: calc(1.4em + 26px);
padding: 12px 16px 14px;
text-align: left;
width: 100%;
}

.open .combo-input {
border-radius: 4px 4px 0 0;
}

.combo-input:focus {
border-color: #0067b8;
box-shadow: 0 0 4px 2px #0067b8;
outline: 4px solid transparent;
}

.combo-label {
display: block;
font-size: 20px;
font-weight: 100;
margin-bottom: 0.25em;
}

.combo-menu {
background-color: #f5f5f5;
border: 1px solid rgba(0, 0, 0, 0.75);
border-radius: 0 0 4px 4px;
display: none;
max-height: 300px;
overflow-y:scroll;
left: 0;
position: absolute;
top: 100%;
width: 100%;
z-index: 100;
}

.open .combo-menu {
display: block;
}

.combo-option {
padding: 10px 12px 12px;
}

.combo-option:hover {
background-color: rgba(0, 0, 0, 0.1);
}

.combo-option.option-current {
outline: 3px solid #0067b8;
outline-offset: -3px;
}

.combo-option[aria-selected="true"] {
padding-right: 30px;
position: relative;
}

.combo-option[aria-selected="true"]::after {
border-bottom: 2px solid #000;
border-right: 2px solid #000;
content: '';
height: 16px;
position: absolute;
right: 15px;
top: 50%;
transform: translate(0, -50%) rotate(45deg);
width: 8px;
}
1 change: 1 addition & 0 deletions examples/combobox/grid-combo.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ <h1>Editable Combobox with Grid Popup Example</h1>
</p>
<p>Similar examples include: </p>
<ul>
<li><a href="examples/combobox/combobox-select-only.html">Select-Only Combobox</a>: A single-select combobox with no text input that is functionally similar to an HTML <code>select</code> element.</li>
<li><a href="combobox-autocomplete-both.html">Editable Combobox with Both List and Inline Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with inline autocomplete</q>.</li>
<li><a href="combobox-autocomplete-list.html">Editable Combobox with List Autocomplete</a>: An editable combobox that demonstrates the autocomplete behavior known as <q>list with manual selection</q>.</li>
<li><a href="combobox-autocomplete-none.html">Editable Combobox Without Autocomplete</a>: An editable combobox that demonstrates the behavior associated with <code>aria-autocomplete=none</code>.</li>
Expand Down
Loading

0 comments on commit 4674776

Please sign in to comment.