Comments (4)
I was inspecting _this in hideMenu and the inputNode can be used to detect if the menu is rendered in the DOM. e.g. if _this.inputNode.offsetParent is undefined it's not rendered. Probably a more standard way of detecting this.
from react-bootstrap-typeahead.
Hey @duhmojo, thanks for opening this issue, and for the detailed repro steps and additional investigation. It looks like the flushSync
call is coming from react-popper
which controls the menu overlay. As far as I can tell, the component is still mounted when setState
is called, so it's possible there's some kind of race condition going on.
I plan to drop the react-popper
dependency in a future version and the error no longer repros with the update, so I think it's safe to ignore the error for now and it will be resolved going forward, probably in v7.
from react-bootstrap-typeahead.
@ericgio when would v7 come out? I would like to find a way to resolve this issue. Will ignore the warning for now. Thank you for your time.
from react-bootstrap-typeahead.
I'm going to comment on this issue with my work around. I ignored this for months then had to come back to it.
I was able to set a ref for Typeahead, then onBlur get the ref and call hideMenu() to force the menu closed before anything else in the React lifecycle could execute.
this.searchRefs[field.name] = React.createRef();
return (
<Col key={index}>
<FormGroup>
<Form.Label>
{field.label}
</Form.Label>
<Typeahead
ref={this.searchRefs[field.name]}
onBlur={(e) => {
if (this.searchRefs[field.name] !== undefined) {
this.searchRefs[field.name].current.hideMenu();
}
}}
I will say that hideMenu was no where in the docs, but was in the reference object and code.
from react-bootstrap-typeahead.
Related Issues (20)
- remove defaultProps from ClearButton HOT 1
- 6.3.0 defaults isLoading to true HOT 1
- Package failing in parcel bundler HOT 1
- Using Typeahead as Ref / createRef<Typeahead<any>>() / TS 5.2 / react 18.2.0 HOT 1
- Allow component in `labelKey` HOT 1
- There is no required attribute HOT 1
- Disabled options can be selected by pressing Tab key HOT 2
- Feature Request - Sorting Options Based on Search Query
- Max tokens prop when multiple
- When multiple is set to true to have the possibility of having the menu open when clicking on an option and close on click outside
- Can't access custom MenuItem html HOT 4
- Clear button has small duplicate x (extra span) HOT 1
- When adding this Typeahead component my react application won't load anymore HOT 1
- MenuItem component only displays a subset of suggestions HOT 3
- Typescript types incompatible on examplecode
- Accessible id is not being applied correctly, cannot access element via label text HOT 3
- Copy pasting any value with spaces should remove spaces. HOT 1
- Please delete this issue
- AsyncTypeahead renders old options before new options
- clearButton not shown with defaultInputValue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-bootstrap-typeahead.