Skip to content
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 a11y audit 0-6: focus order for the copy button on code example #2699

Merged
merged 13 commits into from
Oct 14, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions site/assets/js/partials/code-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default () => {

// Boosted mod: removed unused svg height, width and fill="currentColor"
const btnHtml = [
'<div class="bd-code-snippet">',
' <div class="bd-clipboard">',
' <button type="button" class="btn-clipboard">',
'<div class="bd-code-snippet position-relative">',
' <div class="bd-clipboard position-absolute top-0 end-0">',
' <button type="button" class="btn-clipboard position-absolute end-0">',
vprothais marked this conversation as resolved.
Show resolved Hide resolved
' <svg class="bi" role="img" aria-label="Copy"><use xlink:href="#clipboard"/></svg>',
' </button>',
' </div>',
Expand All @@ -35,7 +35,7 @@ export default () => {
// Ignore examples made by shortcode
if (!element.closest('.bd-example-snippet')) {
element.insertAdjacentHTML('beforebegin', btnHtml)
element.previousElementSibling.append(element)
element.previousElementSibling.prepend(element)
}
})

Expand Down
Loading