Is there a way to make the tab order honour the visual order?
up vote
0
down vote
favorite
Let's say I have a web page which contains a list of links.
<ul class="links">
<li><a href="#">Alpha</a></li>
<li><a href="#">Bravo</a></li>
<li><a href="#">Charlie</a></li>
</ul>
For design reasons, I need to change the order of these links on larger screens so that "Alpha" is visually at the bottom of the list.
@media (min-width: 30em) {
.links {
display: flex;
flex-direction: column;
}
.links > li:first-child {
order: 1;
}
}
When tabbing through the various focusable elements on the page, the visual order of these links is not honoured, thus when tabbing through the list the focus order will be "Alpha" then "Bravo" then "Charlie".
If I set a positive tabindex
on any of those links, they are moved to the end of the tab order (since all other focusable elements essentially have a tab index of 0
).
My question is: is there a way to make the tab order honour the visual order?.
html css tab-ordering
add a comment |
up vote
0
down vote
favorite
Let's say I have a web page which contains a list of links.
<ul class="links">
<li><a href="#">Alpha</a></li>
<li><a href="#">Bravo</a></li>
<li><a href="#">Charlie</a></li>
</ul>
For design reasons, I need to change the order of these links on larger screens so that "Alpha" is visually at the bottom of the list.
@media (min-width: 30em) {
.links {
display: flex;
flex-direction: column;
}
.links > li:first-child {
order: 1;
}
}
When tabbing through the various focusable elements on the page, the visual order of these links is not honoured, thus when tabbing through the list the focus order will be "Alpha" then "Bravo" then "Charlie".
If I set a positive tabindex
on any of those links, they are moved to the end of the tab order (since all other focusable elements essentially have a tab index of 0
).
My question is: is there a way to make the tab order honour the visual order?.
html css tab-ordering
Probably not. Unless you specify a positive value fortabindex
the focus will follow the DOM and not really care about whatever CSS you apply to move things around. I'd create a separate element with the right order and hide it on desktop / mobile.
– I haz kode
yesterday
1
w3.org/TR/css-flexbox-1/#order-accessibility
– jeanpaulxiao
yesterday
1
@jeanpaulxiao nice find. If you provide an answer that basically says "according to the specs, no" and include that link, I'll accept it as the answer.
– James Long
yesterday
1
So what you need to do is move it using script... and if without script you can duplicate the item and toggle display values.
– René
yesterday
@René I think you're right. The only solution seems to be to adjust the markup rather than simply the styles
– James Long
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Let's say I have a web page which contains a list of links.
<ul class="links">
<li><a href="#">Alpha</a></li>
<li><a href="#">Bravo</a></li>
<li><a href="#">Charlie</a></li>
</ul>
For design reasons, I need to change the order of these links on larger screens so that "Alpha" is visually at the bottom of the list.
@media (min-width: 30em) {
.links {
display: flex;
flex-direction: column;
}
.links > li:first-child {
order: 1;
}
}
When tabbing through the various focusable elements on the page, the visual order of these links is not honoured, thus when tabbing through the list the focus order will be "Alpha" then "Bravo" then "Charlie".
If I set a positive tabindex
on any of those links, they are moved to the end of the tab order (since all other focusable elements essentially have a tab index of 0
).
My question is: is there a way to make the tab order honour the visual order?.
html css tab-ordering
Let's say I have a web page which contains a list of links.
<ul class="links">
<li><a href="#">Alpha</a></li>
<li><a href="#">Bravo</a></li>
<li><a href="#">Charlie</a></li>
</ul>
For design reasons, I need to change the order of these links on larger screens so that "Alpha" is visually at the bottom of the list.
@media (min-width: 30em) {
.links {
display: flex;
flex-direction: column;
}
.links > li:first-child {
order: 1;
}
}
When tabbing through the various focusable elements on the page, the visual order of these links is not honoured, thus when tabbing through the list the focus order will be "Alpha" then "Bravo" then "Charlie".
If I set a positive tabindex
on any of those links, they are moved to the end of the tab order (since all other focusable elements essentially have a tab index of 0
).
My question is: is there a way to make the tab order honour the visual order?.
html css tab-ordering
html css tab-ordering
asked yesterday
James Long
3,27211323
3,27211323
Probably not. Unless you specify a positive value fortabindex
the focus will follow the DOM and not really care about whatever CSS you apply to move things around. I'd create a separate element with the right order and hide it on desktop / mobile.
– I haz kode
yesterday
1
w3.org/TR/css-flexbox-1/#order-accessibility
– jeanpaulxiao
yesterday
1
@jeanpaulxiao nice find. If you provide an answer that basically says "according to the specs, no" and include that link, I'll accept it as the answer.
– James Long
yesterday
1
So what you need to do is move it using script... and if without script you can duplicate the item and toggle display values.
– René
yesterday
@René I think you're right. The only solution seems to be to adjust the markup rather than simply the styles
– James Long
yesterday
add a comment |
Probably not. Unless you specify a positive value fortabindex
the focus will follow the DOM and not really care about whatever CSS you apply to move things around. I'd create a separate element with the right order and hide it on desktop / mobile.
– I haz kode
yesterday
1
w3.org/TR/css-flexbox-1/#order-accessibility
– jeanpaulxiao
yesterday
1
@jeanpaulxiao nice find. If you provide an answer that basically says "according to the specs, no" and include that link, I'll accept it as the answer.
– James Long
yesterday
1
So what you need to do is move it using script... and if without script you can duplicate the item and toggle display values.
– René
yesterday
@René I think you're right. The only solution seems to be to adjust the markup rather than simply the styles
– James Long
yesterday
Probably not. Unless you specify a positive value for
tabindex
the focus will follow the DOM and not really care about whatever CSS you apply to move things around. I'd create a separate element with the right order and hide it on desktop / mobile.– I haz kode
yesterday
Probably not. Unless you specify a positive value for
tabindex
the focus will follow the DOM and not really care about whatever CSS you apply to move things around. I'd create a separate element with the right order and hide it on desktop / mobile.– I haz kode
yesterday
1
1
w3.org/TR/css-flexbox-1/#order-accessibility
– jeanpaulxiao
yesterday
w3.org/TR/css-flexbox-1/#order-accessibility
– jeanpaulxiao
yesterday
1
1
@jeanpaulxiao nice find. If you provide an answer that basically says "according to the specs, no" and include that link, I'll accept it as the answer.
– James Long
yesterday
@jeanpaulxiao nice find. If you provide an answer that basically says "according to the specs, no" and include that link, I'll accept it as the answer.
– James Long
yesterday
1
1
So what you need to do is move it using script... and if without script you can duplicate the item and toggle display values.
– René
yesterday
So what you need to do is move it using script... and if without script you can duplicate the item and toggle display values.
– René
yesterday
@René I think you're right. The only solution seems to be to adjust the markup rather than simply the styles
– James Long
yesterday
@René I think you're right. The only solution seems to be to adjust the markup rather than simply the styles
– James Long
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Currently there doesn't seem to be a way to united flex ordering and HTML ordering,
according to https://www.w3.org/TR/css-flexbox-1/#order-property and section 5.4.1. Reordering and Accessibility:
Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.
New contributor
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Currently there doesn't seem to be a way to united flex ordering and HTML ordering,
according to https://www.w3.org/TR/css-flexbox-1/#order-property and section 5.4.1. Reordering and Accessibility:
Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.
New contributor
add a comment |
up vote
0
down vote
accepted
Currently there doesn't seem to be a way to united flex ordering and HTML ordering,
according to https://www.w3.org/TR/css-flexbox-1/#order-property and section 5.4.1. Reordering and Accessibility:
Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.
New contributor
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Currently there doesn't seem to be a way to united flex ordering and HTML ordering,
according to https://www.w3.org/TR/css-flexbox-1/#order-property and section 5.4.1. Reordering and Accessibility:
Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.
New contributor
Currently there doesn't seem to be a way to united flex ordering and HTML ordering,
according to https://www.w3.org/TR/css-flexbox-1/#order-property and section 5.4.1. Reordering and Accessibility:
Authors must use order only for visual, not logical, reordering of content. Style sheets that use order to perform logical reordering are non-conforming.
New contributor
New contributor
answered yesterday
jeanpaulxiao
1635
1635
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416967%2fis-there-a-way-to-make-the-tab-order-honour-the-visual-order%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Probably not. Unless you specify a positive value for
tabindex
the focus will follow the DOM and not really care about whatever CSS you apply to move things around. I'd create a separate element with the right order and hide it on desktop / mobile.– I haz kode
yesterday
1
w3.org/TR/css-flexbox-1/#order-accessibility
– jeanpaulxiao
yesterday
1
@jeanpaulxiao nice find. If you provide an answer that basically says "according to the specs, no" and include that link, I'll accept it as the answer.
– James Long
yesterday
1
So what you need to do is move it using script... and if without script you can duplicate the item and toggle display values.
– René
yesterday
@René I think you're right. The only solution seems to be to adjust the markup rather than simply the styles
– James Long
yesterday