How to use the imask.HTMLMaskElement function in imask

To help you get started, we’ve selected a few imask examples, based on popular ways it is used in public projects.

github stone-payments / emerald-web-framework / packages / emd-basic-field / src / helpers / maskMaker.js View on Github external
import iMask from 'imask';

// This monkey patch fixes the way iMask detects if an input is currently
// active since, in our case, we must look for the shadowRoot.activeElement
// and not the document.activeElement.

Object.defineProperty(iMask.HTMLMaskElement.prototype, 'isActive', {
  get () {
    const rootElement = this.input.getRootNode
      ? this.input.getRootNode() || document
      : document;

    return this.input === rootElement.activeElement;

export const maskMaker = config => domEl => iMask(domEl, config);


vanilla javascript input mask

Latest version published 6 days ago

Package Health Score

81 / 100
Full package analysis

Similar packages