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 can I disable keyboard navigation/set tabindex for q-expansion-items?

    Help
    2
    4
    608
    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.
    • D
      dmoylan last edited by

      TLDR: My issue is with tabindex and q-expansion-item: When tabbing away from the previous input, I don’t want to focus the expansion item (default behaviour). I’d like the focus to move straight to the next input.


      I have a form which uses a q-input/q-checkbox inside the :header slot of an expansion-item. The idea being the conditional rendering of a follow-up field within the expansion content. I’d love keyboard navigation to skip straight to the input.

      The tabindex attribute doesn’t work for me on q-expansion-item, nor does the @focus event, or adding helper classes such as non-selectable to the expansion item or its header-class attribute (@focus and tabindex aren’t listed in the API docs for expansion-item - they are however available for q-item, which it says expansion-item is a version of). Also tried :attributes="{tabindex: ‘-1’}" Fiddling with those same things on the header slot contents doesn’t work either.

      Am I missing something, or is quasar missing something? Are there any other approaches I could take here?

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @dmoylan last edited by

        @dmoylan

        this might help:

        https://forum.vuejs.org/t/how-to-cancel-a-keypress/5922

        https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Vue_refs_focus_management

        1 Reply Last reply Reply Quote 1
        • D
          dmoylan last edited by

          @dobbel
          Thanks for the response. I guess what you are saying is that I should add a keydown listener in my inputs and override tab behaviour, setting focus manually. I was kind of hoping to hear that I was doing something wrong with :tabindex or that the API for q-expansion-item does in fact manage this somehow. But I had overlooked this approach, so thanks. Things will get a little more janky because I am inside a v-for, but it should work.

          Also, I had no idea that MDN had it’s own docs for Vue, so that’s cool to know.

          dobbel 1 Reply Last reply Reply Quote 0
          • dobbel
            dobbel @dmoylan last edited by

            @dmoylan I was surprised too about MDN!

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