-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Prevent loading auto lightbox when disabled using data-amp-auto-lightbox-disable attribute #37854
Changes from 2 commits
06cd333
a103fa0
d83723a
6c63263
64dd31f
825c1c2
02ff8d1
9fdcd6a
ffafca2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -241,10 +241,6 @@ describes.realWin( | |
accepts: 'elements inside non-clickable anchor', | ||
wrapWith: () => html` <a id="my-anchor"></a> `, | ||
}, | ||
{ | ||
rejects: 'explicitly opted-out subnodes', | ||
mutate: (el) => el.setAttribute('data-amp-auto-lightbox-disable', ''), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Undo this removal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done 👍🏻 |
||
}, | ||
{ | ||
rejects: 'amp-subscriptions subnodes', | ||
mutate: (el) => el.setAttribute('subscriptions-action', ''), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,11 @@ export const AutoLightboxEvents_Enum = { | |
export function installAutoLightboxExtension(ampdoc) { | ||
const {win} = ampdoc; | ||
// Only enabled on single documents tagged as <html amp> or <html ⚡>. | ||
if (!isAmphtml(win.document) || !ampdoc.isSingleDoc()) { | ||
if ( | ||
!isAmphtml(win.document) || | ||
!ampdoc.isSingleDoc() || | ||
win.document.body.hasAttribute('data-amp-auto-lightbox-disable') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When this is called, we can't guarantee that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jridgewell Should it be something like this: <html ⚡ lang="en" data-amp-auto-lightbox-disable>
...
</html> Please correct me if there is misinterpretation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's correct. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. Let me revise implementation 👍🏻 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jridgewell Done. I have revised implementation and updated markdown (refer 02ff8d1) Let me know if there is anything that needs to be taken care of. |
||
) { | ||
return; | ||
} | ||
chunk( | ||
|
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.
Don't we want this documentation here still? How else will people know?
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 removed this line from here because it won't be executed as we are excluding the amp-auto-lightbox.js script if the
data-amp-auto-lightbox-disable
attribute is present in the body. Can you suggest any.md
file where we can document this attribute for people to know?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.
This should be left, since it allows individual opt outs without disabling all auto-lightbox.