Material-ui: [SelectField] onFocus and onBlur not being called

Created on 3 Feb 2016  路  12Comments  路  Source: mui-org/material-ui

My code is as follows:

<SelectField
    onFocus={() => console.log('focus')}>
    {
         [<MenuItem/>]
    }
</SelectField>
bug 馃悰 Select

Most helpful comment

Is the issue resolved ?

All 12 comments

Same story here, onFocus is not called for SelectField.

@oliviertassinari What does it mean _onFocus event are now emitted on the AutoComplete component_? Could you please elaborate on how AutoComplete is connected to SelectField? Should I use AutoComplete along with SelectField in order to get onFocus to work in SelectField? How? Could you please draw an example?

@wzup I'm gonna remove AutoComplete references from this issue. The two components are not linked.

@shilpan were you able to find a workaround for this issue?

hi, what about this issue now?

Is the issue resolved ?

Is the issue resolved?

No, I don't think so.

Is the issue resolved ?

Still no? ... For those of you that need that functionality, I tried out react-select and it satisfied our business needs.

no onFocus, no onClick...

Yeah, I am trying to implement onBlur against a SelectField, but to no avail :(

I temporarily resolved the problem by setting onBlur on all my MenuItems... (for onBlur only, I didn't check for onFocus).

Still, it's not perfect. Depending on the zone of the click, onBlur can be directly called, and my error message is visually displayed quicker than the MenuItems =/

@alicerocheman onClick is ok for me

I am having this issue as well!

I'm having this issue as well.
I'm using @MathieuLorber 's technique inserting onBlur on the menuItens and also using onBlur on the SelectField

for the focus, I got onClick for clicking focus and onFocusCapture on a parent div for keyboard focus

Clicking on the arrow fires both handlers, clicking anywhere else only fires onClick

a very ugly workaround and you'll get many unnecessary calls, but it may help someone desperate

Was this page helpful?
0 / 5 - 0 ratings