-
Notifications
You must be signed in to change notification settings - Fork 116
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
Fix: Keyboard navigation should only focus meaningful elements #970
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,8 @@ | |
</div> | ||
</div> | ||
</div> | ||
<div class="bp" tabindex="0" data-testid="bp"> | ||
<div class="bp-content" tabindex="0" data-testid="bp-content"> | ||
<div class="bp" data-testid="bp" tabindex="-1"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do both of these need to be programmatically focusable? It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
<div class="bp-content" data-testid="bp-content" tabindex="-1"> | ||
<div class="bp-loading-wrapper"> | ||
<div class="bp-loading"> | ||
<div class="bp-icon bp-icon-file"></div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1347,21 +1347,27 @@ class DocBaseViewer extends BaseViewer { | |
|
||
let metricName; | ||
let eventName; | ||
let style; | ||
if (!this.thumbnailsSidebar.isOpen) { | ||
this.rootEl.classList.remove(CLASS_BOX_PREVIEW_THUMBNAILS_OPEN); | ||
metricName = USER_DOCUMENT_THUMBNAIL_EVENTS.CLOSE; | ||
eventName = 'thumbnailsClose'; | ||
style = 'display: none'; | ||
} else { | ||
this.rootEl.classList.add(CLASS_BOX_PREVIEW_THUMBNAILS_OPEN); | ||
metricName = USER_DOCUMENT_THUMBNAIL_EVENTS.OPEN; | ||
eventName = 'thumbnailsOpen'; | ||
style = ''; | ||
} | ||
|
||
this.emitMetric({ name: metricName, data: pagesCount }); | ||
this.emit(eventName); | ||
|
||
// Resize after the CSS animation to toggle the sidebar is complete | ||
setTimeout(() => this.resize(), THUMBNAILS_SIDEBAR_TRANSITION_TIME); | ||
setTimeout(() => { | ||
this.resize(); | ||
this.thumbnailsSidebarEl.style = style; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like setting Also, does this affect the animation transition at all? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does appear to affect the hidden -> visible transition. I'll update it to remove the |
||
}, THUMBNAILS_SIDEBAR_TRANSITION_TIME); | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
button
work better thana
in this case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anchors without an
href
attribute are considered placeholders rather than links and aren't included in the tab order (source). Since we just want to response to a user action rather than navigating, a button seems more semantically correct and also obviates the need fortabindex="0"