-
Notifications
You must be signed in to change notification settings - Fork 28
Added a fix for the lightbox #762
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
base: develop
Are you sure you want to change the base?
Conversation
|
@CrochetFeve0251 Thank you for the PR. The issue has been fixed but there is a console error that's not there with Uncaught TypeError: Cannot read properties of null (reading 'focus')This can be seen here:
Can you please check this? 🙏 |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesFootnotes
|
|
@remyperona Thanks for the update. |
|
It's not expected, but this WP feature is also not planned to work with picture element I think. I would say it's an acceptable side effect compared to the current issue. |
|
Items for exploratory
|
nicomollet
left a comment
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.
It looks good but needs proper QA
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.
Pull request overview
This pull request fixes a lightbox issue by preventing WordPress-specific data-wp attributes from being passed to the <picture> tag element. The fix filters out attributes with keys containing 'data-wp' before building the picture tag HTML, while still preserving these attributes on the inner <img> tag where they may be needed.
Key changes:
- Added filtering logic using
array_filterto removedata-wp*attributes from picture tag - Maintains backward compatibility by only affecting the picture tag, not the img tag
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $picture_attributes = array_filter( | ||
| $attributes, | ||
| function ( $attribute ) { | ||
| return strpos( $attribute, 'data-wp' ) === false; |
Copilot
AI
Jan 8, 2026
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.
The current check using strpos($attribute, 'data-wp') === false will filter out any attribute containing 'data-wp' anywhere in the key name, not just those starting with 'data-wp'. For more precise filtering of WordPress-specific attributes, consider using strpos($attribute, 'data-wp-') !== 0 or strncmp($attribute, 'data-wp-', 8) !== 0 to ensure only attributes that start with 'data-wp-' are filtered out. This prevents accidentally filtering attributes that may contain 'data-wp' in other positions.
| return strpos( $attribute, 'data-wp' ) === false; | |
| return strncmp( $attribute, 'data-wp-', 8 ) !== 0; |
| $picture_attributes = array_filter( | ||
| $attributes, | ||
| function ( $attribute ) { | ||
| return strpos( $attribute, 'data-wp' ) === false; | ||
| }, | ||
| ARRAY_FILTER_USE_KEY | ||
| ); |
Copilot
AI
Jan 8, 2026
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.
Consider adding an inline comment above the array_filter call to explain why data-wp attributes are being filtered out from the picture tag. This would help future maintainers understand the purpose of this filtering, especially in relation to the lightbox fix mentioned in issue #758.


Description
Added a fix for the lightbox by not passing the wp attributes to the picture tag.
Fixes #758
Type of change
Please delete options that are not relevant.
Is the solution different from the one proposed during the grooming?
No.
Checklists
Generic development checklist
Test summary
If not, detail what you could not test.
Please describe any additional tests you performed.