馃枍 Added shopping tag flip on too far position to the right by jshamble 路 Pull Request #37195 路 ampproject/amphtml (original) (raw)
Conversation
Added the ability to have a shopping tag auto-change it's pill position to the left of the dot if it is too far to the right of the screen.
Also flips the dot to align with the correct spot for RTL languages.
Fixes #37028
| Normal LTR | Flipped LTR |
|---|---|
![]() |
![]() |
| Normal RTL | Flipped RTL |
|---|---|
![]() |
![]() |
Hey @gmajoulet! These files were changed:
extensions/amp-story-shopping/0.1/amp-story-shopping-tag.css
extensions/amp-story-shopping/0.1/amp-story-shopping-tag.js
extensions/amp-story-shopping/0.1/test/test-amp-story-shopping-tag.js
jshamble changed the title
馃枍 Added shopping tag flip on specific position to the right 馃枍 Added shopping tag flip on too far position to the right
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a screenshot of a story that includes both normal and flipped shopping tags?
There's another piece to this concept that needs to be worked into this PR.
The element needs to be transformed so that the indicator dot is in the same place as it was before the flip. This ensures that the tag will be on screen.
An approach:
If the element is off-screen on the right:
translateX by -100% + the size of the dot.
If off-screen on the left, a flipped version of the same equation can be used.
We will need to make this check on window resize:
Jan-14-2022.10-46-01.mp4
We need to hide the button until the calculation is made and the element is flipped. Otherwise we see it flash on one side then flip to the other:
This could be accomplished by setting opacity to 0 initially and setting it to 1 after the check and positioning is done.
Also the margin between the button and pill is gone.
Please bring that back.
Jan-14-2022.11-39-53.mp4
鈥use the window of the whoel apge and intead use the window of the mobile regtangle in a separate pr
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome!
The margins are broken in RTL. Please take a look into this:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})





