-
-
Notifications
You must be signed in to change notification settings - Fork 777
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 hotkey trigger for clipboard sharing option #6277
fix hotkey trigger for clipboard sharing option #6277
Conversation
Clipboard sharing uses <button> instead of <a>, so the selector does not find it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'll be a recent regression. It was changed to <button>
because it wasn't really a link. 👍
I prefer these selectors. It keeps the code cleaner&clearer. The |
@math-GH Can you please made a code suggestion from the review page? |
@@ -697,7 +697,7 @@ function auto_share(key) { | |||
if (!share) { | |||
return; | |||
} | |||
const shares = share.parentElement.querySelectorAll('.dropdown-menu .item a'); | |||
const shares = share.parentElement.querySelectorAll('.dropdown-menu .item [data-type]'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const shares = share.parentElement.querySelectorAll('.dropdown-menu .item [data-type]'); | |
const shares = share.parentElement.querySelectorAll('.dropdown-menu .item.share a, .dropdown-menu .item.share button'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another idea could be to add a share-action
class on the <button>
and <a>
in \app\views\helpers\index\normal\entry_bottom.phtml
. It would make the JavaScript line better:
const shares = share.parentElement.querySelectorAll('.dropdown-menu .item.share .share-action');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could write it as .dropdown-menu .item.share :is(a, button)
nowadays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but I do not like to travers on tags, I prefer to travers ids and classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the original proposal with [data-type]
does that better than adding a classname. [data-x]
is clearly meant for JS and not for styling.
Clipboard sharing uses
<button>
instead of<a>
, so the hotkey does not work because the selector does not find it.Closes #6276
Changes proposed in this pull request:
How to test the feature manually:
Pull request checklist:
Additional info:
The selector
.dropdown-menu .item a, .dropdown-menu .item button
can be used too, but it's more verbose than the one proposed.