@khanacademy/wonder-blocks-form 6.0.5 → 6.0.6

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,12 @@
1
1
  # @khanacademy/wonder-blocks-form
2
2
 
3
+ ## 6.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - d9bc865b: TextField and TextArea: Set `aria-required` if it is required
8
+ - d9bc865b: TextField and TextArea validation: Always clear error message onChange if instantValidation=false so externally set error state can still be cleared
9
+
3
10
  ## 6.0.5
4
11
 
5
12
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -604,11 +604,9 @@ const useFieldValidation = ({
604
604
  if (_instantValidation) {
605
605
  handleValidation(newValue);
606
606
  } else {
607
- if (errorMessage) {
608
- setErrorMessage(null);
609
- if (onValidate) {
610
- onValidate(null);
611
- }
607
+ setErrorMessage(null);
608
+ if (onValidate) {
609
+ onValidate(null);
612
610
  }
613
611
  }
614
612
  };
@@ -723,6 +721,7 @@ const TextField = props => {
723
721
  value: value,
724
722
  name: name,
725
723
  "aria-disabled": disabled,
724
+ "aria-required": !!required,
726
725
  onChange: handleChange,
727
726
  onKeyDown: disabled ? undefined : onKeyDown,
728
727
  onFocus: handleFocus,
@@ -1134,6 +1133,7 @@ const TextArea = React.forwardRef(function TextArea(props, ref) {
1134
1133
  wrap: wrap,
1135
1134
  minLength: minLength,
1136
1135
  maxLength: maxLength,
1136
+ "aria-required": !!required,
1137
1137
  onClick: disabled ? undefined : onClick,
1138
1138
  onKeyDown: disabled ? undefined : onKeyDown,
1139
1139
  onKeyUp: disabled ? undefined : onKeyUp,
package/dist/index.js CHANGED
@@ -633,11 +633,9 @@ const useFieldValidation = ({
633
633
  if (_instantValidation) {
634
634
  handleValidation(newValue);
635
635
  } else {
636
- if (errorMessage) {
637
- setErrorMessage(null);
638
- if (onValidate) {
639
- onValidate(null);
640
- }
636
+ setErrorMessage(null);
637
+ if (onValidate) {
638
+ onValidate(null);
641
639
  }
642
640
  }
643
641
  };
@@ -752,6 +750,7 @@ const TextField = props => {
752
750
  value: value,
753
751
  name: name,
754
752
  "aria-disabled": disabled,
753
+ "aria-required": !!required,
755
754
  onChange: handleChange,
756
755
  onKeyDown: disabled ? undefined : onKeyDown,
757
756
  onFocus: handleFocus,
@@ -1163,6 +1162,7 @@ const TextArea = React__namespace.forwardRef(function TextArea(props, ref) {
1163
1162
  wrap: wrap,
1164
1163
  minLength: minLength,
1165
1164
  maxLength: maxLength,
1165
+ "aria-required": !!required,
1166
1166
  onClick: disabled ? undefined : onClick,
1167
1167
  onKeyDown: disabled ? undefined : onKeyDown,
1168
1168
  onKeyUp: disabled ? undefined : onKeyUp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-form",
3
- "version": "6.0.5",
3
+ "version": "6.0.6",
4
4
  "design": "v1",
5
5
  "description": "Form components for Wonder Blocks.",
6
6
  "main": "dist/index.js",