Opened 5 years ago
Closed 4 years ago
#48198 closed defect (bug) (fixed)
Customizer: Can't get out of search view in Menu editor
Reported by: | garrett-eclipse | Owned by: | whyisjake |
---|---|---|---|
Milestone: | 5.5 | Priority: | normal |
Severity: | normal | Version: | 5.1 |
Component: | Customize | Keywords: | has-screenshots has-patch needs-testing |
Focuses: | ui, javascript, administration | Cc: |
Description
Hello,
While testing a patch for customizer I used the search function on the Menu editor. This works and I can add items form it. But I can't leave the menu search and return to the previous view. It persists after you click the X, which just clears the input, and stays there even if you go out of the menu to another menu... I have to reload to return to the normal view.
It would be nice to latch into the X on the search input so when you clear your search it switches views. If users want to search again the input it still present. Maybe along with tieing into the X also just revert views when the input is emptied and only switch to search results when text has been input.
Thanks
Attachments (7)
Change History (20)
#1
@
5 years ago
Oo... hmm the loop in my GIF makes it look like you do return to the default view... thats just the gif looping back to the start.
#2
follow-up:
↓ 3
@
5 years ago
The function of that little "x" seems to simply be to clear the search field, not to close the whole search pane.
#3
in reply to:
↑ 2
@
5 years ago
Replying to tobifjellner:
The function of that little "x" seems to simply be to clear the search field, not to close the whole search pane.
Thanks @tobifjellner that's what I found as well, it simply dismisses the text but really should revert the view as there's no way currently to get back to the previous view without a reload.
#5
@
5 years ago
Additional details:
- when clearing the search field using the keyboard, either with the Backspace key or Cmd (Ctrl) + A and delete, the menu items list gets back
- when clicking the
clear-results
button, it doesn't
@
5 years ago
Gif to illustrate the fix and how clicking the clear-results will reset the search panel.
#6
@
5 years ago
- Keywords has-patch needs-testing added
- Version set to 4.6
Thanks for pointing me in the right direction @afercia, I've uploaded an initial patch to address this in 48198.diff.
Please test, I've uploaded a screencast of the resulting change. Now when clicking the clear-results
X button we reset the search panel and hide the X button.
Note: I'm not overly familiar with Customizer js so am unsure if how I setup the $searchSection
\$otherSections
variables is correct or if they should be attached to this
like is done with this.$clearResults
and this.$search
.
#7
@
5 years ago
- Version changed from 4.6 to 5.1
After some additional software archeology, I think this broke in WordPress 5.1 after [44539] where the keyup
event was removed for both the Menus and Widgets searches.
The keyup
event was also programmatically triggered to clear the search and reset the search results thus also the Widgets search reset was broken.
[45658] / #47534 fixed the issue for the Widgets but it didn't fix the Menus.
48198.2.diff just changes the keyup
remnants to input
to restore the intended behavior. It's a simpler approach and doesn't require to repeat code that is already in place. Some testing would be nice :)
Note: the patch also removes some stray spaces and tab characters because my editor does that automatically.
#8
@
5 years ago
- Milestone changed from Awaiting Review to 5.5
Thanks @afercia that's a much more elegant approach. Testing it works nicely, but I found the widgets doesn't clear the X so I applied similar logic to the widgets to have the two search mechanism fall in line. I applied that in 48198.3.diff.
Please review and more testing is welcome.
#9
@
5 years ago
Hello @garrett-eclipse
I'm testing it (5.5a) but does not work for me.
Also, if you click the "Add items" (in customizer), write something, and click again the "add item" button to close, and them click it again, the input is empty, but the list remains the same (with the last result list). So, should it be empty when you close the panel?
#10
@
5 years ago
Thanks for testing @JavierCasares.
Reapplying the patch on a fresh trunk everything functioned as expected for me along with when you close the panel and reopen it clears the search. Did you apply the patch before building the install?
What setup and browser are you using? Happy to help figure out what's going on here, feel free to ping me on slack (@garrett-eclipse) and hopefully we can isolate the issues you're having.
Illustration of issue, can't get the search view to dismiss unless I reload.