vj4/ui/components/form/textbox.page.js

Summary

Maintainability
A
1 hr
Test Coverage
import { AutoloadPage } from 'vj/misc/PageLoader';

const textboxPage = new AutoloadPage('textboxPage', () => {
  $(document).on('focusin', '.textbox.material input', ev => {
    $(ev.currentTarget).parent().addClass('focus');
  });

  $(document).on('focusout', '.textbox.material input', ev => {
    $(ev.currentTarget).parent().removeClass('focus');
  });

  const $focusElement = $(document.activeElement);
  if ($focusElement.prop('tagName') === 'INPUT'
    && $focusElement.parent().is('.textbox.material')
  ) {
    $focusElement.focusin();
  }
});

export default textboxPage;