Opened 7 years ago
Last modified 6 years ago
#42288 new defect (bug)
Validation of custom menu link
Reported by: | dvirhazout | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 4.8.2 |
Component: | Menus | Keywords: | needs-patch needs-testing |
Focuses: | javascript | Cc: |
Description
- go to menus page
- try to add custom menu link with label only. without a URL.
expected and actual result: validation failed and link cannot be added.
- go to menus page
- add custom menu link with label and URL: '#'
- save menu
- edit the custom link from the menu and remove the URL.
- click save
expected result: validation failed and menu won't be saved.
actual result: menu saved. no validation.
Attachments (1)
Change History (5)
#1
in reply to:
↑ description
;
follow-up:
↓ 2
@
7 years ago
#2
in reply to:
↑ 1
;
follow-up:
↓ 3
@
7 years ago
If that's the case, I can't understand the motive to this validation from the first place.
Replying to audrasjb:
Replying to dvirhazout:
Hello,
I think that is the desired behavior.
Indeed, a user might need to use an empty anchor (preferably using "#").
For example, this allows a multilevel menu to add some "virtual" (non-clickable) levels that only serve to unfold the child levels.
#3
in reply to:
↑ 2
@
7 years ago
- Keywords needs-patch added
@dvirhazout you are right WordPress core team need to add patch for validation or they have to remove validation when anyone add custom menu without link.
Replying to dvirhazout:
If that's the case, I can't understand the motive to this validation from the first place.
Replying to audrasjb:
Replying to dvirhazout:
Hello,
I think that is the desired behavior.
Indeed, a user might need to use an empty anchor (preferably using "#").
For example, this allows a multilevel menu to add some "virtual" (non-clickable) levels that only serve to unfold the child levels.
#4
@
6 years ago
- Keywords needs-testing added
Attached a diff, which adds validation for the custom link URLs in the Customizer menus. Using the exact same regex, which is used on the frontend code. The validation now checks the URL format for the submitted strings, and if the URL is empty it invalidates that too. (https://github.com/jukra/wordpress-develop/pull/1)
Replying to dvirhazout:
Hello,
I think that is the desired behavior.
Indeed, a user might need to use an empty anchor (preferably using "#").
For example, this allows a multilevel menu to add some "virtual" (non-clickable) levels that only serve to unfold the child levels.