Skip opening the dropdown if the click event is from the error message (https://github.com/woocommerce/woocommerce-admin/pull/8094)

* Skip focusing the dropdown if the click event is from the error message

fix woocommerce/woocommerce-admin#7906

Update conmments

* Add changelogs
This commit is contained in:
Chi-Hsuan Huang 2022-01-04 11:00:05 +08:00 committed by GitHub
parent 2f290d79a9
commit a2f0390ac8
3 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: Fix
Fix clicking the error message opens the dropdown. #8094

View File

@ -2,6 +2,7 @@
- Fix usage of Wordpress DatePicker component in `DatePicker`. #7982
- Fix select-control component label/value alignment. #8045
- Fix clicking the error message opens the dropdown. #8094
# 8.1.1

View File

@ -217,8 +217,14 @@ class Control extends Component {
'is-disabled': disabled,
}
) }
onClick={ () => {
this.input.current.focus();
onClick={ ( event ) => {
// Don't focus the input if the click event is from the error message.
if (
event.target.className !==
'components-base-control__help'
) {
this.input.current.focus();
}
} }
>
{ isSearchable && (