Skip to content

Commit

Permalink
[controls] fix Korean characters split into 2 characters with space i…
Browse files Browse the repository at this point in the history
…n between when typing in options list search input (#213164)

Closes #213150

Test steps
* Follow https://www.youtube.com/watch?v=vjulSf3Kwu4 to setup duel
language inputs with English and Korean.
* Create a dashboard with an options list. Switch to Korean input and
type in option list control. Type the characters `d` and `k` on an
english keyboard.
* Ensure input treats value as a single character.
<img width="591" alt="Screenshot 2025-03-04 at 1 52 14 PM"
src="https://github.com/user-attachments/assets/c7cfe0f5-156d-4949-932a-96067bf20fd6"
/>

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3ce9019)
  • Loading branch information
nreese committed Mar 4, 2025
1 parent d3a58d9 commit e1f1ca9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export const useBatchedOptionalPublishingSubjects = <
* Batches the latest values of multiple publishing subjects into a single object. Use this to avoid unnecessary re-renders.
* Use when `subjects` are static and do not change over the lifetime of the component.
*
* Do not use when value is used as an input value to avoid debouncing user interactions
*
* @param subjects Publishing subjects array.
*/
export const useBatchedPublishingSubjects = <
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import {
EuiText,
EuiToolTip,
} from '@elastic/eui';
import { useBatchedPublishingSubjects } from '@kbn/presentation-publishing';
import {
useBatchedPublishingSubjects,
useStateFromPublishingSubject,
} from '@kbn/presentation-publishing';

import { getCompatibleSearchTechniques } from '../../../../../common/options_list/suggestions_searching';
import { useOptionsListContext } from '../options_list_context_provider';
Expand All @@ -36,16 +39,18 @@ export const OptionsListPopoverActionBar = ({
}: OptionsListPopoverProps) => {
const { api, stateManager, displaySettings } = useOptionsListContext();

// Using useStateFromPublishingSubject instead of useBatchedPublishingSubjects
// to avoid debouncing input value
const searchString = useStateFromPublishingSubject(stateManager.searchString);

const [
searchString,
searchTechnique,
searchStringValid,
invalidSelections,
totalCardinality,
field,
allowExpensiveQueries,
] = useBatchedPublishingSubjects(
stateManager.searchString,
stateManager.searchTechnique,
stateManager.searchStringValid,
api.invalidSelections$,
Expand Down

0 comments on commit e1f1ca9

Please sign in to comment.