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

Add New Window Warning Fix #822

Merged
merged 16 commits into from
Jan 2, 2025

Conversation

pattonwebz
Copy link
Member

@pattonwebz pattonwebz commented Nov 22, 2024

This adds a fix for new window warnings. It is based entirely on the same feature from the ANWW plugin with some refactoring.

Checklist

  • PR is linked to the main issue in the repo
  • Tests are added that cover changes

This code is based entirely on the ANWW plugin with some minor refactor to remove need for JQuery and to avoid function nesting since it's already a module
@pattonwebz pattonwebz requested a review from Copilot November 22, 2024 22:57

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 8 changed files in this pull request and generated no suggestions.

Files not reviewed (2)
  • includes/classes/Fixes/Fix/AddNewWindowWarning.php: Language not supported
  • includes/classes/Fixes/FixesManager.php: Language not supported
Comments skipped due to low confidence (2)

src/frontendFixes/Fixes/newWindowWarning.js:5

  • [nitpick] The variable 'label' is reassigned multiple times within the 'updateAriaLabel' function. Consider using a local variable instead.
let label = '';

src/frontendFixes/Fixes/newWindowWarning.js:64

  • The empty 'if' block at line 64 is unnecessary and should be removed to clean up the code.
if ( ! hasIcon ) {
@pattonwebz pattonwebz requested a review from Copilot November 22, 2024 23:04

Choose a reason for hiding this comment

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

Copilot reviewed 6 out of 8 changed files in this pull request and generated no suggestions.

Files not reviewed (2)
  • includes/classes/Fixes/Fix/AddNewWindowWarning.php: Language not supported
  • includes/classes/Fixes/FixesManager.php: Language not supported
Comments skipped due to low confidence (1)

src/frontendFixes/Fixes/newWindowWarning.js:3

  • [nitpick] The variable name 'localizedOpenString' is ambiguous. It should be renamed to 'localizedNewWindowWarning' to better reflect its purpose.
const localizedOpenString = __( 'opens a new window', 'accessibility-checker' );
@pattonwebz pattonwebz marked this pull request as ready for review December 5, 2024 15:27
@pattonwebz
Copy link
Member Author

I have added a check that will unregister the ANWW scripts and styles if the plugin is detected and the fix is enabled. I also added a notice to the fixes page to inform users that the plugin won't be needed if the fix is used.

Peek.2025-01-02.14-39.mp4

Screenshot from 2025-01-02 15-14-05

partials/admin-page/fixes-page.php Outdated Show resolved Hide resolved
Co-authored-by: Steve Jones <steve@stevejonesdev.com>
@pattonwebz pattonwebz merged commit 5efb5ba into develop Jan 2, 2025
16 checks passed
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