Origami Frontend Components & Services

Readme: o-hoverable

o-hoverable has a support status of "deprecated". This means that no new features will be added to this component, but security-related bugs will be fixed. We do not recommend using this component in new projects. If you still rely on this component or have concerns, please contact the Origami team.

Deprecated. We recommend the hover or any-hover media query instead.

Helper to activate hover states only on devices that support them, preventing unintended hover effects from happening on touch devices.


Add this class to the document to enable hover effects:

<!-- This class gets removed on touch devices -->
<html class="o-hoverable-on">

Why o-hoverable?

It's common for interactive elements on web pages to have hover effects, either via JavaScript mouse* events, or via CSS :hover pseudoclasses. However, while some users will be interacting with your web page using a mouse, others may be using a touch screen. Since touch screens typically don't have a 'hover' capability, hover effects are usually undesirable.

In fact, some touch devices may have 'emulated hover', where the first touch activates a hover effect and the second is treated as a click. This is a way for the browser to provide a way to use pages that 'require' hover (e.g. to select a flyout menu option) but this is also usually undesirable if you design your site sensibly.

This module provides for all Origami hover effects to be turned on and off, and provides a JavaScript utility to do so intelligently based on the input devices available to the user.


Component developers must prefix :hover states with $o-hoverable-if-hover-enabled, allowing hover effects to be configured by this module:

@import 'o-hoverable/main';

#{$o-hoverable-if-hover-enabled} .o-mymodule-button:hover {
    // Paint it black when hover is supported
    background: black;

Compiles to:

.o-hoverable-on .o-mymodule-button:hover {
    background: black;


Component developers must load hover effects conditionnally:

function showMyMenuOnHover() {
    if (!require('o-hoverable').isHoverEnabled()) {
        // Hover isn't supported: don't do anything
    // Hover is supported: show a menu

Configuring the class

If you want to change the class used to trigger hover effects, you can do so by redefining the $o-hoverable-if-hover-enabled variable before importing this module's Sass.

$o-hoverable-if-hover-enabled: '.do-that-hover-thang';

And calling setClassName on the JavaScript module:


Disabling o-hoverable

Restore hover effects on all devices (even touch devices):

$o-hoverable-if-hover-enabled: '';
@import 'o-hoverable/main';

#{$o-hoverable-if-hover-enabled} .o-mymodule-button:hover {
    // Paint it black
    background: black;

Compiles to:

.o-mymodule-button:hover {
    background: black;


If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #ft-origami or email Origami Support.


This software is published by the Financial Times under the MIT licence.

Switch component view

GitHub Repository

Install o-hoverable

If using the Build Service, add o-hoverable@^3.2.1 to your script and link tags.

If running a Manual Build, run bower install --save "o-hoverable@^3.2.1".

Help & Support

o-hoverable is maintained directly by the Origami team. If you have any questions about o-hoverable or Origami in general, we are happy to help. 😊

Slack: #ft-origami
Email: origami.support@ft.com

Feedback / Issues

To report a bug or request features please create an issue on Github. For support or general feedback please get in touch 😊

Slack: #ft-origami
Email: origami.support@ft.com