Skip to content
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

chore: Fix picture image click event handling #9575

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

filzrev
Copy link
Contributor

@filzrev filzrev commented Jan 3, 2024

Fix #9571

What's changed this PR
Add <picture> tag special handling to makeClickable() function.

<picture> tag's img.currentSrc is changed dynamically based on context.
So it need to add onClick event handler to picture tag itself.

Test Code

<div>
<picture>
    <source srcset="images/example_dark.png" media="(max-width: 600px)" alt=""/>
    <img src="images/example.png" alt=""/>
</picture>
</div>

What's tested manually

  1. When window size is over 600px. images/example.png is displayed. and this image opened when clicking.
  2. When window size is <= 600 px. images/example_dark.png" is displayed. and this image opened when clicking.
  3. Other <img> tags behavior is not changed (wrapped by anchor tag)

@filzrev filzrev force-pushed the chore-fix-picture-clickable-links branch from d25c6b6 to 8ef8934 Compare January 3, 2024 00:34
@yufeih yufeih added the bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note label Jan 3, 2024
Copy link
Contributor

@yufeih yufeih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @filzrev !

@yufeih yufeih merged commit 7ecccf6 into dotnet:main Jan 3, 2024
8 checks passed
@filzrev filzrev deleted the chore-fix-picture-clickable-links branch April 1, 2024 05:03
p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Makes the pull request to appear in "Bug Fixes" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Images that use HTML <picture> tag is not works in some condition
2 participants