Skip to content

Commit 7650275

Browse files
KaiminHuangAustin Green
authored andcommitted
chore(docs): update autocomplete examples due to google translate bug (#394)
1 parent f627af1 commit 7650275

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/dropdowns/src/examples/autocomplete.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ The `<Dropdown>` package does not include any filtering logic. The simplest way
22
perform filtering is to control the `inputValue` and `onInputValueChange` props and
33
conditionally render `<Item>`s as necessary.
44

5+
Due to a known issue caused by google translation extension, which replaces text node
6+
with `<font>` while React keeps references to the text node.
7+
Any conditionally rendered text node should be wrapped with `<span>`.
8+
Read the [React issue](https://github.com/facebook/react/issues/11538#issuecomment-390386520)
9+
for more information.
10+
511
```js
612
const debounce = require('lodash.debounce');
713
const options = [
@@ -67,7 +73,7 @@ function ExampleAutocomplete() {
6773

6874
return matchingOptions.map(option => (
6975
<Item key={option} value={option}>
70-
{option}
76+
<span>{option}</span>
7177
</Item>
7278
));
7379
};
@@ -91,7 +97,7 @@ function ExampleAutocomplete() {
9197
<span aria-label="Garden emoji" role="image">
9298
🌱
9399
</span>
94-
{selectedItem}
100+
<span>{selectedItem}</span>
95101
</Autocomplete>
96102
</Field>
97103
<Menu>{renderOptions()}</Menu>

0 commit comments

Comments
 (0)