q-item hover color disable
Is there any way to disable the hover color in q-item? I tried to do but couldn't get that
Hi, we also had the same problem in our project and added pure CSS we did not want to be clicked but wanted to be have hover color if the dynamic hover is needed then assign me to this issue, if it's not then discard this comment please I will add the hover so: -- if user want to add hover to non clickable items (it's important) -- add or remove the hover on clickable items
for now I want to add just hover prop to it as boolean
in next steps even we can pass the color which the user want to be set on on hover thanks
The hover highlight on QItem is not a separate style that can be toggled, it is the visual affordance of the item being interactive. It is applied when the item is clickable, or when it acts as a router link (to / href), or when it is tag="label", and it is suppressed on disable. It is the only signal telling the user that the row can be activated, so there is no switch to turn it off and we are not planning to add one. An item declared interactive should look interactive.
In practice this question almost always comes from rows carrying clickable v-ripple that do not actually do anything when clicked. Our own docs examples contributed to that habit, and we will revisit them. If the row is not interactive, the fix is to drop clickable (and v-ripple along with it). No hover highlight is applied then, and that is the correct answer for the large majority of cases.
There is a way to get the QItem layout with none of the interactive behavior, using the layout classes directly. We are documenting it here for completeness, not recommending it:
<q-list bordered separator>
<div class="q-item q-item-type row no-wrap cursor-pointer" @click="onClick">
<q-item-section>Single line item</q-item-section>
</div>
</q-list>
QList borders and separators keep working, because they key off q-item-type. But be clear about what you are giving up: this is an anti-pattern. A plain div with a click handler cannot be reached or activated by keyboard, carries no role, and is invisible as a control to screen readers. That is a Level A failure of WCAG 2.1.1 (Keyboard) and 4.1.2 (Name, Role, Value), and it is a genuine one, unlike the hover question itself. QItem's clickable mode exists precisely to give you the tabindex, the keyboard activation and the role for free.
So: if you want a row that responds to clicks, use clickable and accept the hover highlight that comes with it. If you would rather trade away keyboard and screen reader access to avoid a hover tint, the markup above is how, and it is your application and your call to make. We are not going to add an API for it.
@successbyte thank you for the offer, but we are declining the reverse of it as well: putting a hover highlight on non-clickable items would signal an interactivity that is not there, which is a worse outcome for users than the original complaint. Styling hover yourself on your own non-interactive rows in app CSS is of course fine.
Closing as working as designed.