mirror of
https://github.com/picocss/pico.git
synced 2025-04-23 18:06:14 -04:00
chore: updated implementation with proper roles and aria attributes
This commit is contained in:
parent
25d7c7983f
commit
aaa4aebb2f
15 changed files with 81 additions and 81 deletions
|
@ -2033,22 +2033,22 @@ progress::-moz-progress-bar {
|
|||
background-position: -200% 0;
|
||||
}
|
||||
}
|
||||
details[role=dropdown] {
|
||||
details[role=list] {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
details[role=dropdown] summary {
|
||||
details[role=list] summary {
|
||||
margin-bottom: 0;
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
border: var(--border-width) solid var(--form-element-border-color);
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
}
|
||||
details[role=dropdown] summary::after {
|
||||
details[role=list] summary::after {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
details[role=dropdown] summary + ul {
|
||||
details[role=list] summary + ul {
|
||||
z-index: 100;
|
||||
position: absolute;
|
||||
top: auto;
|
||||
|
@ -2063,33 +2063,33 @@ details[role=dropdown] summary + ul {
|
|||
background-color: var(--background-color);
|
||||
list-style: none;
|
||||
}
|
||||
details[role=dropdown] summary + ul li {
|
||||
details[role=list] summary + ul li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
details[role=dropdown] summary + ul li::marker {
|
||||
details[role=list] summary + ul li::marker {
|
||||
content: "";
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=radio],
|
||||
details[role=dropdown] summary + ul li input[type=checkbox] {
|
||||
details[role=list] summary + ul li input[type=radio],
|
||||
details[role=list] summary + ul li input[type=checkbox] {
|
||||
display: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
details[role=dropdown] summary + ul li label {
|
||||
details[role=list] summary + ul li label {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
line-height: 1;
|
||||
}
|
||||
details[role=dropdown] summary + ul li label:hover {
|
||||
details[role=list] summary + ul li label:hover {
|
||||
background-color: var(--secondary-focus);
|
||||
}
|
||||
details[role=dropdown] summary + ul li input:checked + label {
|
||||
details[role=list] summary + ul li input:checked + label {
|
||||
background-color: var(--secondary-focus);
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=checkbox] + label:before {
|
||||
details[role=list] summary + ul li input[type=checkbox] + label:before {
|
||||
display: inline-block;
|
||||
width: calc(var(--spacing) * 1.2);
|
||||
height: calc(var(--spacing) * 1.2);
|
||||
|
@ -2099,24 +2099,24 @@ details[role=dropdown] summary + ul li input[type=checkbox] + label:before {
|
|||
content: "";
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=checkbox]:checked + label:before {
|
||||
details[role=list] summary + ul li input[type=checkbox]:checked + label:before {
|
||||
background-image: var(--icon-checkbox);
|
||||
background-position: center;
|
||||
background-size: calc(var(--spacing) * 0.8) auto;
|
||||
background-repeat: no-repeat;
|
||||
background-color: var(--primary);
|
||||
}
|
||||
details[role=dropdown][disabled] summary, details[role=dropdown].disabled summary {
|
||||
details[role=list][disabled] summary, details[role=list].disabled summary {
|
||||
color: var(--muted-color);
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
details[role=dropdown][open] summary {
|
||||
details[role=list][open] summary {
|
||||
margin-bottom: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
details[role=dropdown][open] summary::before {
|
||||
details[role=list][open] summary::before {
|
||||
display: block;
|
||||
z-index: 80;
|
||||
position: fixed;
|
||||
|
@ -2128,7 +2128,7 @@ details[role=dropdown][open] summary::before {
|
|||
content: " ";
|
||||
cursor: default;
|
||||
}
|
||||
details[role=dropdown][open] summary::after {
|
||||
details[role=list][open] summary::after {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
2
css/pico.classless.min.css
vendored
2
css/pico.classless.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
34
css/pico.css
34
css/pico.css
|
@ -2316,22 +2316,22 @@ progress::-moz-progress-bar {
|
|||
background-position: -200% 0;
|
||||
}
|
||||
}
|
||||
details[role=dropdown] {
|
||||
details[role=list] {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
details[role=dropdown] summary {
|
||||
details[role=list] summary {
|
||||
margin-bottom: 0;
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
border: var(--border-width) solid var(--form-element-border-color);
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
}
|
||||
details[role=dropdown] summary::after {
|
||||
details[role=list] summary::after {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
details[role=dropdown] summary + ul {
|
||||
details[role=list] summary + ul {
|
||||
z-index: 100;
|
||||
position: absolute;
|
||||
top: auto;
|
||||
|
@ -2346,33 +2346,33 @@ details[role=dropdown] summary + ul {
|
|||
background-color: var(--background-color);
|
||||
list-style: none;
|
||||
}
|
||||
details[role=dropdown] summary + ul li {
|
||||
details[role=list] summary + ul li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
details[role=dropdown] summary + ul li::marker {
|
||||
details[role=list] summary + ul li::marker {
|
||||
content: "";
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=radio],
|
||||
details[role=dropdown] summary + ul li input[type=checkbox] {
|
||||
details[role=list] summary + ul li input[type=radio],
|
||||
details[role=list] summary + ul li input[type=checkbox] {
|
||||
display: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
details[role=dropdown] summary + ul li label {
|
||||
details[role=list] summary + ul li label {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
line-height: 1;
|
||||
}
|
||||
details[role=dropdown] summary + ul li label:hover {
|
||||
details[role=list] summary + ul li label:hover {
|
||||
background-color: var(--secondary-focus);
|
||||
}
|
||||
details[role=dropdown] summary + ul li input:checked + label {
|
||||
details[role=list] summary + ul li input:checked + label {
|
||||
background-color: var(--secondary-focus);
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=checkbox] + label:before {
|
||||
details[role=list] summary + ul li input[type=checkbox] + label:before {
|
||||
display: inline-block;
|
||||
width: calc(var(--spacing) * 1.2);
|
||||
height: calc(var(--spacing) * 1.2);
|
||||
|
@ -2382,24 +2382,24 @@ details[role=dropdown] summary + ul li input[type=checkbox] + label:before {
|
|||
content: "";
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=checkbox]:checked + label:before {
|
||||
details[role=list] summary + ul li input[type=checkbox]:checked + label:before {
|
||||
background-image: var(--icon-checkbox);
|
||||
background-position: center;
|
||||
background-size: calc(var(--spacing) * 0.8) auto;
|
||||
background-repeat: no-repeat;
|
||||
background-color: var(--primary);
|
||||
}
|
||||
details[role=dropdown][disabled] summary, details[role=dropdown].disabled summary {
|
||||
details[role=list][disabled] summary, details[role=list].disabled summary {
|
||||
color: var(--muted-color);
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
details[role=dropdown][open] summary {
|
||||
details[role=list][open] summary {
|
||||
margin-bottom: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
details[role=dropdown][open] summary::before {
|
||||
details[role=list][open] summary::before {
|
||||
display: block;
|
||||
z-index: 80;
|
||||
position: fixed;
|
||||
|
@ -2411,7 +2411,7 @@ details[role=dropdown][open] summary::before {
|
|||
content: " ";
|
||||
cursor: default;
|
||||
}
|
||||
details[role=dropdown][open] summary::after {
|
||||
details[role=list][open] summary::after {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -2003,22 +2003,22 @@ progress::-moz-progress-bar {
|
|||
background-position: -200% 0;
|
||||
}
|
||||
}
|
||||
details[role=dropdown] {
|
||||
details[role=list] {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
details[role=dropdown] summary {
|
||||
details[role=list] summary {
|
||||
margin-bottom: 0;
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
border: var(--border-width) solid var(--form-element-border-color);
|
||||
border-radius: var(--border-radius);
|
||||
cursor: pointer;
|
||||
}
|
||||
details[role=dropdown] summary::after {
|
||||
details[role=list] summary::after {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
details[role=dropdown] summary + ul {
|
||||
details[role=list] summary + ul {
|
||||
z-index: 100;
|
||||
position: absolute;
|
||||
top: auto;
|
||||
|
@ -2033,33 +2033,33 @@ details[role=dropdown] summary + ul {
|
|||
background-color: var(--background-color);
|
||||
list-style: none;
|
||||
}
|
||||
details[role=dropdown] summary + ul li {
|
||||
details[role=list] summary + ul li {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
details[role=dropdown] summary + ul li::marker {
|
||||
details[role=list] summary + ul li::marker {
|
||||
content: "";
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=radio],
|
||||
details[role=dropdown] summary + ul li input[type=checkbox] {
|
||||
details[role=list] summary + ul li input[type=radio],
|
||||
details[role=list] summary + ul li input[type=checkbox] {
|
||||
display: none;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
details[role=dropdown] summary + ul li label {
|
||||
details[role=list] summary + ul li label {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: calc(var(--spacing) * 0.5);
|
||||
line-height: 1;
|
||||
}
|
||||
details[role=dropdown] summary + ul li label:hover {
|
||||
details[role=list] summary + ul li label:hover {
|
||||
background-color: var(--secondary-focus);
|
||||
}
|
||||
details[role=dropdown] summary + ul li input:checked + label {
|
||||
details[role=list] summary + ul li input:checked + label {
|
||||
background-color: var(--secondary-focus);
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=checkbox] + label:before {
|
||||
details[role=list] summary + ul li input[type=checkbox] + label:before {
|
||||
display: inline-block;
|
||||
width: calc(var(--spacing) * 1.2);
|
||||
height: calc(var(--spacing) * 1.2);
|
||||
|
@ -2069,24 +2069,24 @@ details[role=dropdown] summary + ul li input[type=checkbox] + label:before {
|
|||
content: "";
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
details[role=dropdown] summary + ul li input[type=checkbox]:checked + label:before {
|
||||
details[role=list] summary + ul li input[type=checkbox]:checked + label:before {
|
||||
background-image: var(--icon-checkbox);
|
||||
background-position: center;
|
||||
background-size: calc(var(--spacing) * 0.8) auto;
|
||||
background-repeat: no-repeat;
|
||||
background-color: var(--primary);
|
||||
}
|
||||
details[role=dropdown][disabled] summary, details[role=dropdown].disabled summary {
|
||||
details[role=list][disabled] summary, details[role=list].disabled summary {
|
||||
color: var(--muted-color);
|
||||
cursor: not-allowed;
|
||||
pointer-events: none;
|
||||
}
|
||||
details[role=dropdown][open] summary {
|
||||
details[role=list][open] summary {
|
||||
margin-bottom: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
border-bottom-left-radius: 0;
|
||||
}
|
||||
details[role=dropdown][open] summary::before {
|
||||
details[role=list][open] summary::before {
|
||||
display: block;
|
||||
z-index: 80;
|
||||
position: fixed;
|
||||
|
@ -2098,7 +2098,7 @@ details[role=dropdown][open] summary::before {
|
|||
content: " ";
|
||||
cursor: default;
|
||||
}
|
||||
details[role=dropdown][open] summary::after {
|
||||
details[role=list][open] summary::after {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
2
css/pico.fluid.classless.min.css
vendored
2
css/pico.fluid.classless.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
css/pico.min.css
vendored
2
css/pico.min.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -18,9 +18,9 @@
|
|||
<h2>single / multi select dropdown, without JavaScript.</h2>
|
||||
</hgroup>
|
||||
<article aria-label="Dropdown examples">
|
||||
<details role="dropdown">
|
||||
<summary>Single select</summary>
|
||||
<ul>
|
||||
<details role="list">
|
||||
<summary aria-haspopup="listbox">Single select</summary>
|
||||
<ul role="listbox">
|
||||
<li>
|
||||
<input type="radio" id="01" name="option1" />
|
||||
<label for="01">Option 1</label>
|
||||
|
@ -31,9 +31,9 @@
|
|||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
<details role="dropdown">
|
||||
<summary>Multi-select</summary>
|
||||
<ul>
|
||||
<details role="list">
|
||||
<summary aria-haspopup="listbox">Multi-select</summary>
|
||||
<ul role="listbox">
|
||||
<li>
|
||||
<input type="checkbox" id="11" name="option2" />
|
||||
<label for="11">Option 1</label>
|
||||
|
@ -50,7 +50,7 @@
|
|||
<ul>
|
||||
<li>
|
||||
in order to use dropdown component, use
|
||||
<code>role='dropdown'</code> on details tag.
|
||||
<code>role='list'</code> on details tag.
|
||||
</li>
|
||||
<li>
|
||||
no need to use javascript to close the dropdown when clicked
|
||||
|
@ -70,9 +70,9 @@
|
|||
<code>
|
||||
<em>For Single-select</em>
|
||||
<em>===============================</em>
|
||||
<<b>details role="dropdown"</b>>
|
||||
<<b>summary</b>>Single select<<b>/summary</b>>
|
||||
<<b>ul</b>>
|
||||
<<b>details role="list"</b>>
|
||||
<<b>summary aria-haspopup="listbox"</b>>Single select<<b>/summary</b>>
|
||||
<<b>ul role="listbox"</b>>
|
||||
<<b>li</b>>
|
||||
<<b>input type="radio" id="01" name="option1" /</b>>
|
||||
<<b>label for="01"</b>>Option 1<<b>/label</b>>
|
||||
|
@ -87,9 +87,9 @@
|
|||
|
||||
<em>For Multi-select</em>
|
||||
<em>===============================</em>
|
||||
<<b>details role="dropdown"</b>>
|
||||
<<b>summary</b>>Multi select<<b>/summary</b>>
|
||||
<<b>ul</b>>
|
||||
<<b>details role="list"</b>>
|
||||
<<b>summary aria-haspopup="listbox"</b>>Multi select<<b>/summary</b>>
|
||||
<<b>ul role="listbox"</b>>
|
||||
<<b>li</b>>
|
||||
<<b>input type="checkbox" id="01" name="option1" /</b>>
|
||||
<<b>label for="01"</b>>Option 1<<b>/label</b>>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
details[role='dropdown'] {
|
||||
details[role='list'] {
|
||||
position: relative;
|
||||
padding: 0;
|
||||
border-bottom: none;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue