Prevent accidental dragging of audio playback buttons and hint links (#3844)

* Add myself to CONTRIBUTORS

* Set draggable="false" attribute on .replay-button

Because currently if a user drags slightly (even unintentionally) upon clicking a play button, play does not happen

* Prevent dragging hint links

Because if a user moves cursor a little after `mousedown`, action (expanding the hint) does not occur. Which might cause issues from accessibility standpoint
This commit is contained in:
Evgeny Kulikov 2025-03-14 11:47:03 +02:00 committed by GitHub
parent f5f22edb6a
commit 339bf436d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 3 deletions

View file

@ -207,6 +207,7 @@ Luca Auer <lolle2000.la@gmail.com>
Niclas Heinz <nheinz@hpost.net>
Omar Kohl <omarkohl@posteo.net>
David Elizalde <david.elizalde.r.a@gmail.com>
beyondcompute <beyondcompute@gmail.com>
Yuki <https://github.com/YukiNagat0>
wackbyte <wackbyte@protonmail.com>
GithubAnon0000 <GithubAnon0000@users.noreply.github.com>

View file

@ -845,7 +845,7 @@ def av_refs_to_play_icons(text: str) -> str:
def repl(match: re.Match) -> str:
return f"""
<a class="replay-button soundLink" href=# onclick="pycmd('{match.group(1)}'); return false;">
<a class="replay-button soundLink" href=# onclick="pycmd('{match.group(1)}'); return false;" draggable="false">
<svg class="playImage" viewBox="0 0 64 64" version="1.1">
<circle cx="32" cy="32" r="29" />
<path d="M56.502,32.301l-37.502,20.101l0.329,-40.804l37.173,20.703Z" />

View file

@ -192,7 +192,7 @@ fn hint_filter<'a>(text: &'a str, field_name: &str) -> Cow<'a, str> {
<a class=hint href="#"
onclick="this.style.display='none';
document.getElementById('hint{}').style.display='block';
return false;">
return false;" draggable=false>
{}</a>
<div id="hint{}" class=hint style="display: none">{}</div>
"##,
@ -232,7 +232,7 @@ mod test {
<a class=hint href="#"
onclick="this.style.display='none';
document.getElementById('hint83fe48607f0f3a66').style.display='block';
return false;">
return false;" draggable=false>
field</a>
<div id="hint83fe48607f0f3a66" class=hint style="display: none">foo</div>
"##