No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    How to prevent ENTER to open select popup

    Framework
    1
    3
    258
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • labs20
      labs20 last edited by

      Hi.

      I have serious needs to control the keyboard on my project and specially the ENTER and ESC keys that on this particular project, plays a role of a special navigational keys.

      I have an imperative need to block the select popup to show based on some internal checks I have to do. Never mind the user still can click and open the select, but NOT with ENTER key under specific conditions.

      So, I need a way to listen to some event (or “beforeEvent”) and then do my block logic inside.

      How, please? I’ve had trapped the normal key(up/down/press) without success, as it seems that the quasar event that popped it up already happened.

      Can someone shed some light on this? Could quasar start to implement some “before” events and publish some blocking props for common behaviour of the components?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • labs20
        labs20 last edited by

        @rstoenescu , I know that I may be on an edge case here, but a couple of simple props, like useEnterKey (boolean default true) and useDownKey (boolean default true) would do wonders in this case, as one could set the desired key to false, trap the key event, do their thing and if necessary, call showPopup at the end. Win / win.

        That can be done?

        Thanks!

        1 Reply Last reply Reply Quote 0
        • labs20
          labs20 last edited by

          Well, trying to monkey patch my way trough this I’m intercepting showPopup to block it if I need to.

          The QSelect.js implements it like this:

          showPopup (e) {
                if (this.hasDialog === true) {
                  this.__onControlFocusin(e)
                  this.dialog = true
                }
                else {
                  this.__focus()
                }
          
                if (this.$listeners.filter !== void 0) {
                  this.filter(this.inputValue)
                }
                else if (this.noOptions !== true || this.$scopedSlots['no-option'] !== void 0) {
                  this.menu = true
                }
              },
          

          The problem is that when it is called from __onTargetKeydown the e(vent) is not being passed to:

               ...
                if (this.menu === true) {
                  this.__closeMenu()
                }
                else if (this.innerLoading !== true) {
                  this.showPopup()  //<=== e is not propagated HERE
                }
              },
          

          So, although I can intercept it, I can not know witch key was pressed 'cause I dont have the event.

          Any help?

          Thanks

          1 Reply Last reply Reply Quote 0
          • First post
            Last post