<div class="codeBoxHeadline">{$title}{if $filename}: {$filename}{/if}</div>
{if !$isAmp && $lines > 10}
- <span class="toggleButton icon icon24 fa-expand jsTooltip pointer" title="{lang}wcf.bbcode.button.showAll{/lang}" data-title-collapse="{lang}wcf.bbcode.button.collapse{/lang}" data-title-expand="{lang}wcf.bbcode.button.showAll{/lang}"></span>
+ <span class="toggleButton icon icon24 fa-expand jsTooltip pointer" title="{lang}wcf.bbcode.button.showAll{/lang}" data-title-collapse="{lang}wcf.bbcode.button.collapse{/lang}" data-title-expand="{lang}wcf.bbcode.button.showAll{/lang}" role="button" tabindex="0"></span>
{/if}
</div>
{assign var='lineNumber' value=$startLineNumber}
<pre class="codeBoxCode collapsibleBbcodeOverflow"><code{if $language} class="language-{$language}"{/if}>{foreach from=$content item=line}{*
*}{assign var='codeLineID' value='codeLine_'|concat:$lineNumber:'_':$codeID}{*
- *}<span class="codeBoxLine" id="{$codeLineID}"><a href="{@$__wcf->getAnchor($codeLineID)}" class="lineAnchor" title="{@$lineNumber}"></a><span>{$line}</span></span>{*
+ *}<span class="codeBoxLine" id="{$codeLineID}"><a href="{@$__wcf->getAnchor($codeLineID)}" class="lineAnchor" title="{@$lineNumber}" tabindex="-1" aria-hidden="true"></a><span>{$line}</span></span>{*
*}{assign var='lineNumber' value=$lineNumber+1}{*
*}{/foreach}</code></pre>
</div>
{if $collapseQuote}
- <span class="toggleButton" data-title-collapse="{lang}wcf.bbcode.button.collapse{/lang}" data-title-expand="{lang}wcf.bbcode.button.showAll{/lang}">{lang}wcf.bbcode.button.showAll{/lang}</span>
+ <span class="toggleButton" data-title-collapse="{lang}wcf.bbcode.button.collapse{/lang}" data-title-expand="{lang}wcf.bbcode.button.showAll{/lang}" role="button" tabindex="0">{lang}wcf.bbcode.button.showAll{/lang}</span>
<script data-relocate="true">
require(['WoltLabSuite/Core/Bbcode/Collapsible'], function(BbcodeCollapsible) {
}
const button = document.createElement("span");
+ button.tabIndex = 0;
+ button.setAttribute("role", "button");
button.className = "icon icon24 fa-files-o pointer jsTooltip";
button.setAttribute("title", Language.get("wcf.message.bbcode.code.copy"));
- button.addEventListener("click", async () => {
+
+ const clickCallback = async () => {
await Clipboard.copyElementTextToClipboard(this.codeContainer);
UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success"));
+ };
+ button.addEventListener("click", clickCallback);
+ button.addEventListener("keydown", (event) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+
+ void clickCallback();
+ }
});
header.appendChild(button);
toggleButtons.forEach((toggleButton) => {
toggleButton.classList.add("jsToggleButtonEnabled");
toggleButton.addEventListener("click", (ev) => toggleContainer(container, toggleButtons, ev));
+
+ toggleButton.addEventListener("keydown", (event) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+
+ toggleContainer(container, toggleButtons);
+ }
+ });
});
// expand boxes that are initially scrolled
<div class="codeBoxHeadline">{$title}{if $filename}: {$filename}{/if}</div>
{if !$isAmp && $lines > 10}
- <span class="toggleButton icon icon24 fa-expand jsTooltip pointer" title="{lang}wcf.bbcode.button.showAll{/lang}" data-title-collapse="{lang}wcf.bbcode.button.collapse{/lang}" data-title-expand="{lang}wcf.bbcode.button.showAll{/lang}"></span>
+ <span class="toggleButton icon icon24 fa-expand jsTooltip pointer" title="{lang}wcf.bbcode.button.showAll{/lang}" data-title-collapse="{lang}wcf.bbcode.button.collapse{/lang}" data-title-expand="{lang}wcf.bbcode.button.showAll{/lang}" role="button" tabindex="0"></span>
{/if}
</div>
{assign var='lineNumber' value=$startLineNumber}
<pre class="codeBoxCode collapsibleBbcodeOverflow"><code{if $language} class="language-{$language}"{/if}>{foreach from=$content item=line}{*
*}{assign var='codeLineID' value='codeLine_'|concat:$lineNumber:'_':$codeID}{*
- *}<span class="codeBoxLine" id="{$codeLineID}"><a href="{@$__wcf->getAnchor($codeLineID)}" class="lineAnchor" title="{@$lineNumber}"></a><span>{$line}</span></span>{*
+ *}<span class="codeBoxLine" id="{$codeLineID}"><a href="{@$__wcf->getAnchor($codeLineID)}" class="lineAnchor" title="{@$lineNumber}" tabindex="-1" aria-hidden="true"></a><span>{$line}</span></span>{*
*}{assign var='lineNumber' value=$lineNumber+1}{*
*}{/foreach}</code></pre>
return;
}
const button = document.createElement("span");
+ button.tabIndex = 0;
+ button.setAttribute("role", "button");
button.className = "icon icon24 fa-files-o pointer jsTooltip";
button.setAttribute("title", Language.get("wcf.message.bbcode.code.copy"));
- button.addEventListener("click", async () => {
+ const clickCallback = async () => {
await Clipboard.copyElementTextToClipboard(this.codeContainer);
UiNotification.show(Language.get("wcf.message.bbcode.code.copy.success"));
+ };
+ button.addEventListener("click", clickCallback);
+ button.addEventListener("keydown", (event) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+ void clickCallback();
+ }
});
header.appendChild(button);
}
toggleButtons.forEach((toggleButton) => {
toggleButton.classList.add("jsToggleButtonEnabled");
toggleButton.addEventListener("click", (ev) => toggleContainer(container, toggleButtons, ev));
+ toggleButton.addEventListener("keydown", (event) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+ toggleContainer(container, toggleButtons);
+ }
+ });
});
// expand boxes that are initially scrolled
if (overflowContainer.scrollTop !== 0) {