Skip to content

Commit

Permalink
Fixed: When access key is marked before whitespace, this whitespace d…
Browse files Browse the repository at this point in the history
…isappears
  • Loading branch information
palant committed Apr 29, 2023
1 parent 0fe7988 commit 249bd5b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ui/accessKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ function showHints()
accessKeyElements.push(span);

if (index + 1 < text.length)
replacements.push(document.createTextNode(text.substr(index + 1)));
{
let textEnd = text.substr(index + 1);
// Make sure whitespace after the marker isn’t collapsed
textEnd = textEnd.replace(/^ /, "\xA0");
replacements.push(document.createTextNode(textEnd));
}

element.replaceChild(replacements[0], child);
let insertionPoint = replacements[0].nextSibling;
Expand Down Expand Up @@ -216,7 +221,7 @@ function hideHints()
text += element.textContent;
if (element.nextSibling && element.nextSibling.nodeType == Node.TEXT_NODE)
{
text += element.nextSibling.nodeValue;
text += element.nextSibling.nodeValue.replace(/^\xA0/, " ");
element.parentNode.removeChild(element.nextSibling);
}
element.parentNode.replaceChild(document.createTextNode(text), element);
Expand Down

0 comments on commit 249bd5b

Please sign in to comment.