mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 10:50:24 +00:00
a11y: use native button elements where appropriate #982
This commit is contained in:
parent
8c403f2aad
commit
ee07f8ff7d
3 changed files with 6 additions and 5 deletions
|
@ -1479,7 +1479,7 @@ pre:not(.mermaid) .copy-to-clipboard-button:hover {
|
||||||
color: var(--INTERNAL-CODE-BLOCK-BG-color);
|
color: var(--INTERNAL-CODE-BLOCK-BG-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
.disableInlineCopyToClipboard span > code.copy-to-clipboard-code + span.copy-to-clipboard-button {
|
.disableInlineCopyToClipboard span > code.copy-to-clipboard-code + .copy-to-clipboard-button {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1821,6 +1821,7 @@ html[dir='rtl'] .expand[open] > .box-label > i.expander-icon {
|
||||||
|
|
||||||
/* anchors */
|
/* anchors */
|
||||||
.anchor {
|
.anchor {
|
||||||
|
background-color: transparent;
|
||||||
color: var(--INTERNAL-MAIN-LINK-color);
|
color: var(--INTERNAL-MAIN-LINK-color);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 0.5em;
|
font-size: 0.5em;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
7.2.1+6747b8862e1ea7331662a6376ef02a48126816ae
|
7.2.1+8c403f2aadf03c87f7741ead8e4c5425cbe30ed1
|
|
@ -336,7 +336,7 @@ function initMermaid(update, attrs) {
|
||||||
var svg = d3.select(this);
|
var svg = d3.select(this);
|
||||||
svg.html('<g>' + svg.html() + '</g>');
|
svg.html('<g>' + svg.html() + '</g>');
|
||||||
var inner = svg.select('*:scope > g');
|
var inner = svg.select('*:scope > g');
|
||||||
parent.insertAdjacentHTML('beforeend', '<span class="svg-reset-button" title="' + window.T_Reset_view + '"><i class="fas fa-undo-alt"></i></span>');
|
parent.insertAdjacentHTML('beforeend', '<button class="svg-reset-button" title="' + window.T_Reset_view + '"><i class="fas fa-undo-alt"></i></button>');
|
||||||
var button = parent.querySelector('.svg-reset-button');
|
var button = parent.querySelector('.svg-reset-button');
|
||||||
var zoom = d3.zoom().on('zoom', function (e) {
|
var zoom = d3.zoom().on('zoom', function (e) {
|
||||||
inner.attr('transform', e.transform);
|
inner.attr('transform', e.transform);
|
||||||
|
@ -530,7 +530,7 @@ function initAnchorClipboard() {
|
||||||
document.querySelectorAll('h1~h2,h1~h3,h1~h4,h1~h5,h1~h6').forEach(function (element) {
|
document.querySelectorAll('h1~h2,h1~h3,h1~h4,h1~h5,h1~h6').forEach(function (element) {
|
||||||
var url = encodeURI((document.location.origin == 'null' ? document.location.protocol + '//' + document.location.host : document.location.origin) + document.location.pathname);
|
var url = encodeURI((document.location.origin == 'null' ? document.location.protocol + '//' + document.location.host : document.location.origin) + document.location.pathname);
|
||||||
var link = url + '#' + element.id;
|
var link = url + '#' + element.id;
|
||||||
var new_element = document.createElement('span');
|
var new_element = document.createElement('button');
|
||||||
new_element.classList.add('anchor');
|
new_element.classList.add('anchor');
|
||||||
if (!window.relearn.disableAnchorCopy) {
|
if (!window.relearn.disableAnchorCopy) {
|
||||||
new_element.setAttribute('title', window.T_Copy_link_to_clipboard);
|
new_element.setAttribute('title', window.T_Copy_link_to_clipboard);
|
||||||
|
@ -660,7 +660,7 @@ function initCodeClipboard() {
|
||||||
code.parentNode.replaceChild(span, code);
|
code.parentNode.replaceChild(span, code);
|
||||||
code = clone;
|
code = clone;
|
||||||
}
|
}
|
||||||
var button = document.createElement('span');
|
var button = document.createElement('button');
|
||||||
button.classList.add('copy-to-clipboard-button');
|
button.classList.add('copy-to-clipboard-button');
|
||||||
button.setAttribute('title', window.T_Copy_to_clipboard);
|
button.setAttribute('title', window.T_Copy_to_clipboard);
|
||||||
button.innerHTML = '<i class="far fa-copy"></i>';
|
button.innerHTML = '<i class="far fa-copy"></i>';
|
||||||
|
|
Loading…
Reference in a new issue