Skip to content

Commit

Permalink
Sharing Block > Native sharing: use relevant link for popup (#41002)
Browse files Browse the repository at this point in the history
* Use relevant link for sharing popup

See: #39060.

This switches the tooltip to use the associated link, rather than any element containing the `tooltiptext` class within the page.
  • Loading branch information
pkevan authored Jan 15, 2025
1 parent 270e71d commit e8d1fd8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Sharing: Fix the location of the sharing dialog, so it is not always the first sharing element on the page
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if ( typeof window !== 'undefined' ) {
if ( link?.href && isWebShareAPIEnabled( { url: link.href } ) ) {
navigator.share( { url: link.href } );
} else {
const [ tooltip ] = document.getElementsByClassName( 'tooltiptext' );
const [ tooltip ] = link.getElementsByClassName( 'tooltiptext' );
if ( tooltip && tooltip.style ) {
tooltip.style.display = 'initial';
setTimeout( () => {
Expand Down

0 comments on commit e8d1fd8

Please sign in to comment.