Qué es Generador de popover interest invoker?
The interestfor invoker command is a declarative HTML attribute (Chrome 142+) that opens a popover when the user hovers over or focuses the trigger element. Set commandfor='popover-id' and command='interestfor' on a button, and popover='hint' on the target div. The popover opens on hover AND focus, making it keyboard-accessible by default. This replaces manual mouseenter/mouseleave handlers with popover.showPopover()/hidePopover().
Respuesta rápida
Use commandfor='popover-id' and command='interestfor' on a button to open a popover on hover and focus without JavaScript. Set popover='hint' on the target for tooltip behavior. Chrome 142+.
Limitaciones
- The interestfor command requires Chrome 142+. Other browsers do not support it yet, and there is no polyfill. The popover simply won't open in unsupported browsers.
- Popovers opened with interestfor cannot contain interactive content — they close when focus moves away. For interactive popups, use togglePopover or showPopover on click instead.
- interestfor requires the popover target to be in the DOM at page load. Dynamically created popover elements need to be registered before interestfor can reference them.
Cómo usar esta herramienta
- Create a popover element with the popover attribute set to hint (for tooltips) or auto.
- Add a trigger button with commandfor pointing to the popover id and command set to interestfor.
- Optionally add CSS for hover styling on the trigger and position the popover with anchor positioning.
- Test that the popover opens on both mouse hover and keyboard focus for accessibility.
Para qué puedes usarla
- Create an accessible tooltip that opens on hover and focus without writing a single line of JavaScript.
- Build a hover card preview for product links that shows details when the user hovers or tabs to the link.
- Replace JavaScript-based hover menus with declarative popovers that work consistently across mouse and keyboard.