Skip to content

🐛 Fixed broken close buttons on modals#15514

Merged
ronaldlangeveld merged 4 commits intoTryGhost:mainfrom
ronaldlangeveld:fix_close_modal
Oct 4, 2022
Merged

🐛 Fixed broken close buttons on modals#15514
ronaldlangeveld merged 4 commits intoTryGhost:mainfrom
ronaldlangeveld:fix_close_modal

Conversation

@ronaldlangeveld
Copy link
Copy Markdown
Contributor

@ronaldlangeveld ronaldlangeveld commented Oct 2, 2022

Certain modals have close buttons as <a> elements. Those containing {{on "click" @close}} and href="" would not take the on click function into account, meaning the whole page would get redirected to "/" (back to the root of the dashboard) as a result of the href instead of closing the modal.
From my understanding {{on "click" @close}} doesn't enforce preventDefault behaviour.

Reproducible example:
Go to members, apply some filters, click ⚙️ and select "Add label for selected members". The modal should open.
Click the Close (X) button top right of the modal.

This affects more modals, this is just one example.

Version: 5.16.2
Ghost Pro
Chrome and Safari

  • There's a clear use-case for this code change, explained
  • Commit message has a short title & references relevant issues
  • The build will pass (run yarn test:all and yarn lint)

no issue

Some modals' close elements containing `{{on "click" @close}}` and `href=""` would not take the 'on cl
ick' function into account, meaning the whole page would get redirected to "/" (back to the root of the dashboard) instead of just closing the modal.
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 2, 2022

Codecov Report

Base: 52.90% // Head: 52.86% // Decreases project coverage by -0.03% ⚠️

Coverage data is based on head (9ea9a52) compared to base (8751245).
Patch has no changes to coverable lines.

❗ Current head 9ea9a52 differs from pull request most recent head 18f551e. Consider uploading reports for the commit 18f551e to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15514      +/-   ##
==========================================
- Coverage   52.90%   52.86%   -0.04%     
==========================================
  Files        1376     1377       +1     
  Lines       89210    89237      +27     
  Branches     9573     9569       -4     
==========================================
- Hits        47197    47177      -20     
- Misses      41055    41096      +41     
- Partials      958      964       +6     
Impacted Files Coverage Δ
ghost/admin/app/helpers/members-count-fetcher.js 72.22% <0.00%> (-16.67%) ⬇️
ghost/admin/app/controllers/settings/staff/user.js 60.28% <0.00%> (-8.81%) ⬇️
ghost/admin/app/controllers/offer.js 35.26% <0.00%> (-6.32%) ⬇️
ghost/admin/app/routes/offer.js 54.28% <0.00%> (-5.72%) ⬇️
ghost/admin/app/routes/tag.js 65.00% <0.00%> (-5.00%) ⬇️
ghost/admin/app/components/gh-image-uploader.js 84.24% <0.00%> (-1.47%) ⬇️
...p/components/settings/staff/modals/suspend-user.js
...ts/settings/staff/modals/regenerate-staff-token.js
...p/components/settings/staff/modals/upload-image.js
...onents/settings/staff/modals/transfer-ownership.js
... and 16 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ronaldlangeveld ronaldlangeveld marked this pull request as ready for review October 2, 2022 19:00
@ronaldlangeveld ronaldlangeveld changed the title 🐛 Fixed broken close button on modals 🐛 Fixed broken close buttons on modals Oct 2, 2022
Copy link
Copy Markdown
Member

@kevinansfield kevinansfield left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Very minor thing but the role="button" attributes can be removed on actual <button> elements because they're redundant.

@ronaldlangeveld ronaldlangeveld merged commit 226794e into TryGhost:main Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants