@khanacademy/math-input 12.0.1 → 12.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @khanacademy/math-input
2
2
 
3
+ ## 12.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a5a60852: revert focus changes to math input
8
+
3
9
  ## 12.0.1
4
10
 
5
11
  ### Patch Changes
@@ -50,7 +50,7 @@ declare class MathInput extends React.Component<Props, State> {
50
50
  _updateCursorHandle: (arg1?: boolean) => void;
51
51
  _hideCursorHandle: () => void;
52
52
  _handleScroll: () => void;
53
- blur: (callPropsOnBlur: boolean) => void;
53
+ blur: () => void;
54
54
  focus: () => void;
55
55
  /**
56
56
  * Tries to determine which DOM node to place the cursor next to based on
package/dist/es/index.js CHANGED
@@ -1553,11 +1553,9 @@ class MathInput extends React.Component {
1553
1553
  this._hideCursorHandle();
1554
1554
  }
1555
1555
  };
1556
- this.blur = callPropsOnBlur => {
1556
+ this.blur = () => {
1557
1557
  this.mathField.blur();
1558
- if (callPropsOnBlur) {
1559
- this.props.onBlur && this.props.onBlur();
1560
- }
1558
+ this.props.onBlur && this.props.onBlur();
1561
1559
  this.setState({
1562
1560
  focused: false,
1563
1561
  handle: {
@@ -2014,7 +2012,7 @@ class MathInput extends React.Component {
2014
2012
  // dismissal. This code needs to be generalized to handle
2015
2013
  // multi-touch.
2016
2014
  if (this.state.focused && this.didTouchOutside && !this.didScroll) {
2017
- this.blur(true);
2015
+ this.blur();
2018
2016
  }
2019
2017
  this.didTouchOutside = false;
2020
2018
  this.didScroll = false;
@@ -2090,18 +2088,13 @@ class MathInput extends React.Component {
2090
2088
  role: "textbox",
2091
2089
  ariaLabel: ariaLabel
2092
2090
  }, /*#__PURE__*/React.createElement("div", {
2093
- className: "keypad-input",
2094
- tabIndex: 0,
2091
+ className: "keypad-input"
2092
+ // @ts-expect-error - TS2322 - Type 'string' is not assignable to type 'number | undefined'.
2093
+ ,
2094
+ tabIndex: "0",
2095
2095
  ref: node => {
2096
2096
  this.inputRef = node;
2097
2097
  },
2098
- onFocus: () => {
2099
- this.focus();
2100
- },
2101
- onBlur: () => {
2102
- this._hideCursorHandle();
2103
- this.blur(false);
2104
- },
2105
2098
  onKeyUp: this.handleKeyUp
2106
2099
  }, /*#__PURE__*/React.createElement("div", {
2107
2100
  ref: node => {
@@ -5128,21 +5121,17 @@ class MobileKeypad extends React.Component {
5128
5121
  }, 100);
5129
5122
  };
5130
5123
  this.activate = () => {
5131
- if (!this.state.active) {
5132
- this.setState({
5133
- active: true
5134
- });
5135
- }
5124
+ this.setState({
5125
+ active: true
5126
+ });
5136
5127
  };
5137
5128
  this.dismiss = () => {
5138
- if (this.state.active) {
5139
- this.setState({
5140
- active: false
5141
- }, () => {
5142
- var _this$props$onDismiss, _this$props;
5143
- (_this$props$onDismiss = (_this$props = this.props).onDismiss) == null ? void 0 : _this$props$onDismiss.call(_this$props);
5144
- });
5145
- }
5129
+ this.setState({
5130
+ active: false
5131
+ }, () => {
5132
+ var _this$props$onDismiss, _this$props;
5133
+ (_this$props$onDismiss = (_this$props = this.props).onDismiss) == null ? void 0 : _this$props$onDismiss.call(_this$props);
5134
+ });
5146
5135
  };
5147
5136
  this.configure = (configuration, cb) => {
5148
5137
  this.setState({