Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Remove popup suggestions when Backspacing to nothing #534

Closed
grssam opened this issue Jun 9, 2011 · 7 comments
Closed

Remove popup suggestions when Backspacing to nothing #534

grssam opened this issue Jun 9, 2011 · 7 comments

Comments

@grssam
Copy link
Contributor

grssam commented Jun 9, 2011

With speakwords, when we are pressing backspace and then there is nothing left in the urlbar , the awesomebar popup still shows the suggestion based on the last left character.

type "firef" , popup shows suggestions for firefox , start pressing backspace till nothing is left , , awesome bar still shows suggestion for sites/urls/title containing "f"

@Mardak
Copy link
Member

Mardak commented Jun 9, 2011

Not quite sure what event to look for. I tried from "input" where urlbar.value does indeed return "". But calling popupOpen is true and calling closePopup() does close it.. but it seems like something else is re-opening.

@grssam
Copy link
Contributor Author

grssam commented Jun 9, 2011

This listener is bringing back the popup

listen(window, gURLBar.parentNode, "keypress", function(event) {
switch (event.keyCode) {
case event.DOM_VK_BACK_SPACE:
case event.DOM_VK_DELETE:
// The value will be the last search if auto-selected; otherwise the
// value will be the manually selected autocomplete entry
if (gURLBar.value != lastSearch)
return;

    // Hack around to prevent deleting an entry
    let {mPopupOpen} = popup;
    popup.mPopupOpen = false;

    // Restore the original popup open value
    window.setTimeout(function() {
        popup.mPopupOpen = mPopupOpen;
      });       
    break;
}

});

But in this function there is no way to detect if the current keypress (delete or backspace) is going to make the urlbar value to null.

@grssam
Copy link
Contributor Author

grssam commented Jun 9, 2011

the guaranteed way I think is to check if cursor is at beginning while pressing delete for last char , and the cursor is at end while pressing backspace for last char

@Mardak
Copy link
Member

Mardak commented Jun 9, 2011

How does that guarantee correctness when deleting a selection?

@grssam
Copy link
Contributor Author

grssam commented Jun 9, 2011

The fact that making a selection already remove the popup.
And to have nothing left after deleting a selection , the selection should enclose everything. That can be done only using either mouse or left right key presses , which removes the popup .

@Mardak
Copy link
Member

Mardak commented Jun 10, 2011

How did you test this? It doesn't seem to close the popup suggestions for me.

@grssam
Copy link
Contributor Author

grssam commented Jun 10, 2011

sorry , there were some spelling mistakes , I fixed it at my patch-8 branch

@Mardak Mardak closed this as completed in e5aea55 Jul 24, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants