Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent a block and console error for input[type=email] #26074

Closed

Commits on Oct 13, 2020

  1. Prevent a console and block error on input[type=email]

    When this is at the top of a block,
    on first addding the block,
    there is a block and JS error:
    DOMException: Failed to set the 'selectionStart' property on 'HTMLInputElement': The input element's type ('email') does not support selection.
    
    at placeCaretAtHorizontalEdge (https://path/to/wp-content/plugins/gutenberg/build/dom/index.js?ver=cbf62a0bae5cfd2eeff038ee115edc0a:390:32)
    
    This looks to be because
    HTMLInputElement only has a
    selectionStart property
    for 'text/number-containing or elements'
    https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement
    kienstra committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    659a851 View commit details
    Browse the repository at this point in the history
  2. Fix failed Jest test

    It looks like document.createElement( 'input' )
    doesn't create an object
    with .selectionStart.
    So manually add one, although
    it's not ideal.
    kienstra committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    03e6006 View commit details
    Browse the repository at this point in the history
  3. Add a missing ;

    kienstra committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    a1fd12b View commit details
    Browse the repository at this point in the history
  4. Add a test to assert that the caret isn't moved

    If there's no selectionStart,
    it should not be moved.
    kienstra committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    942c68c View commit details
    Browse the repository at this point in the history
  5. Empty commit to trigger build

    PHPUnit tests failed,
    though this PR doesn't touch
    a PHP file:
    https://github.com/WordPress/gutenberg/runs/1249706078
    kienstra committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    920c5f2 View commit details
    Browse the repository at this point in the history
  6. Add in missing ;

    kienstra committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    82c6556 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6170052 View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2020

  1. Configuration menu
    Copy the full SHA
    a431449 View commit details
    Browse the repository at this point in the history