@khanacademy/math-input 17.1.0 → 17.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/index.js CHANGED
@@ -17,7 +17,7 @@ import PropTypes from 'prop-types';
17
17
 
18
18
  // This file is processed by a Rollup plugin (replace) to inject the production
19
19
  const libName = "@khanacademy/math-input";
20
- const libVersion = "17.1.0";
20
+ const libVersion = "17.2.0";
21
21
  addLibraryVersionToPerseusDebug(libName, libVersion);
22
22
 
23
23
  function _extends() {
@@ -1757,6 +1757,7 @@ class MathInput extends React.Component {
1757
1757
  });
1758
1758
  };
1759
1759
  this.handleTouchStart = (e, keypadActive, setKeypadActive) => {
1760
+ var _this$inputRef;
1760
1761
  e.stopPropagation();
1761
1762
 
1762
1763
  // Hide the cursor handle on touch start, if the handle itself isn't
@@ -1784,11 +1785,19 @@ class MathInput extends React.Component {
1784
1785
  if (!this.state.focused) {
1785
1786
  this.focus();
1786
1787
  }
1788
+
1789
+ // If the user clicked on the input using a mouse or tap gesture,
1790
+ // we want to set the focus to the inputRef so that the keyUp
1791
+ // event will be triggered when the user types on the keyboard.
1792
+ // This is necessary to support Chromebooks as they use mobile user
1793
+ // agents, do not simulate touch events, and have physical keyboards.
1794
+ (_this$inputRef = this.inputRef) == null || _this$inputRef.focus();
1787
1795
  };
1788
1796
  // We want to allow the user to be able to focus the input via click
1789
1797
  // when using ChromeOS third-party browsers that use mobile user agents,
1790
1798
  // but don't actually simulate touch events.
1791
1799
  this.handleClick = (e, keypadActive, setKeypadActive) => {
1800
+ var _this$inputRef2;
1792
1801
  e.stopPropagation();
1793
1802
 
1794
1803
  // Hide the cursor handle on click
@@ -1814,6 +1823,13 @@ class MathInput extends React.Component {
1814
1823
  if (!this.state.focused) {
1815
1824
  this.focus();
1816
1825
  }
1826
+
1827
+ // If the user clicked on the input using a mouse or tap gesture,
1828
+ // we want to set the focus to the inputRef so that the keyUp
1829
+ // event will be triggered when the user types on the keyboard.
1830
+ // This is necessary to support Chromebooks as they use mobile user
1831
+ // agents, do not simulate touch events, and have physical keyboards.
1832
+ (_this$inputRef2 = this.inputRef) == null || _this$inputRef2.focus();
1817
1833
  };
1818
1834
  this.handleTouchMove = e => {
1819
1835
  e.stopPropagation();
@@ -1969,7 +1985,7 @@ class MathInput extends React.Component {
1969
1985
  const value = this.mathField.getContent();
1970
1986
  if (this.props.value !== value) {
1971
1987
  this.mathField.setContent(this.props.value);
1972
- this.props.onChange(value, false);
1988
+ this.props.onChange(value, () => {});
1973
1989
  this._hideCursorHandle();
1974
1990
  }
1975
1991
  }