Revert "A11Y: Improve setting focus to post" (#23311)

This reverts commit 9b3fc8081a.
This commit is contained in:
Penar Musaraj 2023-08-29 09:24:16 -04:00 committed by GitHub
parent d47a3e053a
commit 76f4142d3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 13 deletions

View File

@ -803,9 +803,7 @@ export default {
},
_onScrollEndsCallback() {
document
.querySelector(".topic-post.selected a:not([tabindex='-1'])")
?.focus();
document.querySelector(".topic-post.selected span.tabLoc")?.focus();
},
categoriesTopicsList() {

View File

@ -77,8 +77,7 @@ export function highlightPost(postNumber) {
return;
}
// sets focus to the first focusable anchor in the post
container.querySelector("a:not([tabindex='-1'])")?.focus();
container.querySelector(".tabLoc")?.focus();
const element = container.querySelector(".topic-body");
if (!element || element.classList.contains("highlighted")) {

View File

@ -190,6 +190,9 @@ export default createWidget("post-small-action", {
}
return [
h("span.tabLoc", {
attributes: { "aria-hidden": true, tabindex: -1 },
}),
h("div.topic-avatar", iconNode(icons[attrs.actionCode] || "exclamation")),
h("div.small-action-desc", [
h("div.small-action-contents", contents),

View File

@ -751,7 +751,11 @@ createWidget("post-article", {
},
html(attrs, state) {
const rows = [];
const rows = [
h("span.tabLoc", {
attributes: { "aria-hidden": true, tabindex: -1 },
}),
];
if (state.repliesAbove.length) {
const replies = state.repliesAbove.map((p) => {
return this.attach("embedded-post", p, {

View File

@ -1170,6 +1170,11 @@ blockquote > *:last-child {
);
min-width: 0; // Allows flex container to shrink
.avatar {
margin-right: 0.5em;
float: left;
}
p {
margin: 0;
padding: 0.15em 0.5em 0 0;
@ -1178,13 +1183,6 @@ blockquote > *:last-child {
.small-action-contents {
flex: 1 1 auto;
display: flex;
a.trigger-user-card {
display: inline-flex;
align-items: center;
margin-right: 0.5em;
border-radius: 1em;
}
}
.small-action-buttons {

View File

@ -15,6 +15,10 @@
box-shadow: -3px 0 0 var(--danger);
}
.tabLoc:focus {
outline: none;
}
.latest .featured-topic {
padding-left: 4px;
}