Skip to content

🐛 [Story attachment] Opening outlink error for closeButton being null#37833

Merged
mszylkowski merged 19 commits intoampproject:mainfrom
mszylkowski:openoutlink_error
Mar 8, 2022
Merged

🐛 [Story attachment] Opening outlink error for closeButton being null#37833
mszylkowski merged 19 commits intoampproject:mainfrom
mszylkowski:openoutlink_error

Conversation

@mszylkowski
Copy link
Copy Markdown
Contributor

Fixes ampproject/error-reporting#147

Outlinks when opened don't have a closeButton that they can change the tabindex so it was throwing an error. By checking if there's such button we can prevent the error and run the last lines of the open() method properly.

@mszylkowski mszylkowski self-assigned this Mar 8, 2022
@amp-owners-bot
Copy link
Copy Markdown

amp-owners-bot bot commented Mar 8, 2022

Hey @gmajoulet, @newmuis! These files were changed:

extensions/amp-story-page-attachment/0.1/amp-story-page-attachment.js
extensions/amp-story-page-attachment/0.1/test/test-amp-story-page-attachment.js

@mszylkowski mszylkowski requested a review from calebcordry March 8, 2022 18:40
Copy link
Copy Markdown
Member

@calebcordry calebcordry left a comment

Choose a reason for hiding this comment

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

Can we add a test?

@mszylkowski
Copy link
Copy Markdown
Contributor Author

For sure, I think in general the feature is undertested but any unit test that checks this functionality should have picked it up. I'll add a generic test for the outlink component that would have caught this error (and potentially many other ones like it).

@mszylkowski mszylkowski removed the request for review from processprocess March 8, 2022 19:19
Copy link
Copy Markdown
Member

@calebcordry calebcordry left a comment

Choose a reason for hiding this comment

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

Thanks for adding tests!

@mszylkowski mszylkowski enabled auto-merge (squash) March 8, 2022 19:27
@mszylkowski mszylkowski merged commit 435c185 into ampproject:main Mar 8, 2022
@mszylkowski mszylkowski deleted the openoutlink_error branch March 8, 2022 19:46
@processprocess
Copy link
Copy Markdown
Contributor

Thank you for fixing this & writing a test for it ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🚨 Error: Cannot read properties of null (reading 'setAttribute')

4 participants