Opened 10 months ago
Last modified 2 months ago
#60916 assigned defect (bug)
Menu link validation
Reported by: | nikitasolanki1812 | Owned by: | rcreators |
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Menus | Keywords: | has-patch changes-requested |
Focuses: | javascript, administration | Cc: |
Attachments (3)
Change History (20)
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
10 months ago
#2
@
10 months ago
- Focuses accessibility removed
- Milestone changed from Awaiting Review to 6.6
- Owner set to rcreators
- Status changed from new to assigned
- Version 6.5 deleted
#3
@
10 months ago
- Component changed from General to Menus
- Keywords needs-patch added; changes-requested removed
This ticket was mentioned in PR #6389 on WordPress/wordpress-develop by @akrocks.
10 months ago
#4
- Keywords has-patch added; needs-patch removed
Trac ticket: https://core.trac.wordpress.org/ticket/60916
## Description
- This PR adds URL validation to the
Custom Link
menu items.
## Steps to reproduce Bug
- If we try adding
Custom Link
with an empty URL in the Menu, We get a validation error & are not able to addCustom Link
.
- But if we try the same after adding
Custom Link
to the Menu, we don't get the validation error & can addCustom Link
with an empty URL. This breaches the consistency.
## Expected behaviour
- A validation error should be shown if we add
Custom Link
with an empty URL.
## Screenshots/Screencasts
#### Before
- Able to save
Custom Link
with an empty URL.
#### After
- A validation error is displayed if we try to save
Custom Link
with an empty URL.
---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.
@rcreators commented on PR #6389:
9 months ago
#5
@Pathan-Amaankhan Can you make the changes as per suggestions? That will be great.
8 months ago
#7
Hi @Rcreators 👋,
I have updated the PR, as per the suggested changes.
Can you please re-review the PR.
This ticket was mentioned in Slack in #core by oglekler. View the logs.
8 months ago
#9
@
7 months ago
Thank you, everyone, for keeping on with this ticket! In my testing I found a regression and a couple of things that should be addressed (possibly in another ticket).
Test Report
Patch tested: https://github.com/WordPress/wordpress-develop/pull/6389
Steps to Reproduce or Test
- Setup: With a classic theme active that supports menus, set up a new menu and add links using Add menu items > Custom Links:
- Add link with valid URL. Should be added to menu.
- Add link with hash (e.g.
#content
). Should be added to menu. - Add link with random text that isn't a URL. Should be added to menu, prepended by
http://
. - Try using a space for URL, confirm validation occurs. Cannot add.
- Save menu. Should include the three items successfully added above.
- Test using Menu structure to modify links directly:
- Replace URL with a space in one of the links.
- Save menu and observe modified link's URL.
- Save menu again and observe modified link's URL (expect this should be unchanged). Make note of this link and do not modify it before applying patch.
- [Optional] Add valid URL, save, remove URL, save. Should be same as above.
Expected Results
When reproducing the bug:
- ❌ Links with blank or unset (
http://
orhttps://
) URLs are not validated and can be saved.
When testing a patch to validate it works as expected:
- ✅ Links with blank or unset (
http://
orhttps://
) URLs are validated, indicating an error. - ✅ Links with validation errors prevent saving the menu.
Environment
- Hardware: MacBook Pro Apple M1 Pro
- OS: macOS 14.5
- Browser: Safari 17.5
- Server: nginx/1.27.0
- PHP: 8.2.20
- MySQL: 8.0.27
- WordPress: 6.6-alpha-57778-src
- Theme: twentytwentyone v2.2
Actual Results
- Apply patch and run
npm run build:dev
. - Refresh page and make sure the modified blank URL link from above exists.
- Using Menu structure to modify links directly:
- ✅ Expand the link with a blank URL, observe that field displays placeholder (
https://
). - ❌ Observe that field does NOT reflect validation.
- ❌ Save menu without making any changes. Link with blank URL disappears. (Regression: Should not delete links with invalid URL, as they could be unintentionally deleted after patch or WP upgrade.)
- ✅ Delete the URL from one of the other links, confirm validation occurs. Cannot save.
- ⚠️ Enter a space in the URL field, confirm NO validation occurs. (Consistent with before patch; but does not match validation of Custom Links adder.)
- Save menu. Items should include link just modified.
- ⚠️ Expand blank URL link, observe space has been removed, showing placeholder text, confirm NO validation occurs. (Consistent with before patch.)
- ❌ Save menu. Blank URL link disappears. (Regression like above: Should not delete links with invalid URL.)
- ✅ Delete URL from remaining link, confirm validation occurs.
- ✅ Try entering
http://
orhttps://
, confirm validation occurs.
- ✅ Expand the link with a blank URL, observe that field displays placeholder (
Supplemental Artifacts
- Video demonstrating regression and inconsistency of validating for spaces as URL: https://cloudup.com/c-z6eNQLPfb.
#10
@
7 months ago
- Milestone changed from 6.6 to 6.7
Given 6.6 RC1 is coming in 3 days and as regressions were found with the current patch, I'm moving this ticket to milestone 6.7. The ticket is pretty close to its resolution, but the regression have to be addressed before it ships, especially when we are so close to RC1.
This ticket was mentioned in Slack in #core-test by ankit-k-gupta. View the logs.
5 months ago
#12
@
5 months ago
Thanks @akrocks for the PR. This ticket was discussed in Test Scrub session this week. Would you mind updating/addressing the issues identified in the testing here https://core.trac.wordpress.org/ticket/60916#comment:9
This ticket was mentioned in Slack in #core by chaion07. View the logs.
4 months ago
#14
@
4 months ago
Thanks @nikitasolanki1812 for reporting this. We reviewed this Ticket during a recent bug-scrub session. Based on the feedback received we would like to request the following:
- Seconding with Ankit for an update on the issue (regression) found during the test conducted by Brian
- Possible a patch
- Information on the Ticket that Brian suggested to open apart from this one which should address the issues.
Thanks you.
Props to @ironprogrammer, @ankit-k-gupta and @pratiklondhe
Cheers!
This ticket was mentioned in Slack in #core by stoyangeorgiev. View the logs.
4 months ago
#16
@
4 months ago
- Milestone changed from 6.7 to 6.8
This one was discussed during a bug-scrub. With Beta 2 right around the corner, will move this one to 6.8
This ticket was mentioned in PR #7869 on WordPress/wordpress-develop by @rinkalpagdar.
2 months ago
#17
Trac ticket: https://core.trac.wordpress.org/ticket/60916
### Description
_
- This PR adds URL validation to the Custom Link menu items.
### Expected behaviour
_
- A validation error should be shown if we add Custom Link with an empty URL.
### Screenshots/Screencasts
_
This isn't in itself an accessibility issue; consistency between the two fields doesn't impact different users differently.
This does call attention to the validation itself, however, which is not accessible, and I'll open a separate issue for that.