Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[KeyboardDatePicker ] TextField lose focus when open Popover #1877

Closed
lamhungypl opened this issue Jun 10, 2020 · 5 comments
Closed

[KeyboardDatePicker ] TextField lose focus when open Popover #1877

lamhungypl opened this issue Jun 10, 2020 · 5 comments
Labels
status: incomplete Need more information

Comments

@lamhungypl
Copy link

A GIF or MEME to give some spice of the internet

Environment

Tech Version
@material-ui/pickers ^3.2.10
material-ui/core ^4.10.1
TypeScript 3.7.2
React ^16.12.0
Browser Chrome
Peer library

Steps to reproduce

                    <KeyboardDatePicker
                    open = {open}
                    onFocus={handleFocus}
                    onBlur={handleBlur}
                    onAccept={handleAccept}
                    clearable
                    value={selectedDate}
                    placeholder="dd-mm-yyyy"
                    onChange={date => handleDateChange(date)}
                    format="DD-MM-YYYY"
                    keyboardIcon={<div   />}
                    variant="inline"
                    autoOk={true}
                    InputProps={{
                        disableUnderline: true,
                    }}
                    KeyboardButtonProps={{
                        disableFocusRipple: true,
                        disableRipple: true,
                        className: classes.button
                    }}
                    PopoverProps={{
                        anchorOrigin: {
                            vertical: "bottom",
                            horizontal: "right"
                        },
                        transformOrigin: {
                            vertical: "top",
                            horizontal: "center"
                        }
                    }}
                    disableToolbar
                    rightArrowIcon={<IoIosPlay />}
                    leftArrowIcon={<IoIosPlay style={{ transform: "rotate(180deg)" }} />}
                    {...rest}
                />

type in input

Expected behavior

when i typing, show the popover.
when matched date / chose on picker, set value to input and hide poppover.

I don't want to use the adornment button, is there a workaround in ver3.

Actual behavior

TextField lose focus when open Popover

Live example

https://codesandbox.io/s/inputdatepicker-068qp
Screen Shot 2020-06-10 at 11 27 26

@oliviertassinari
Copy link
Member

We do no longer support v3. Please provide a minimal reproduction test case with v4. This would help a lot 👷 .
A live example would be perfect. This codesandbox.io template may be a good starting point. Thank you!

@oliviertassinari oliviertassinari added the status: incomplete Need more information label Jun 10, 2020
@lamhungypl
Copy link
Author

We do no longer support v3.

It seems v4 has handle this use case Migrate to Popper from Popover #1850
I will be forced to migrate KeyboardDatepicker to the new version. Is there a guideline? It has been deprecated, and replaced by DatePicker?

@oliviertassinari
Copy link
Member

KeyboardDatePicker is becoming DesktopDatePicker.

@dmtrKovalenko
Copy link
Member

@lamhungypl TextField will not keep the focus after open with new Popover version. It needs for a11y https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/datepicker-dialog.html

We planed some kind of another component that works similar to DateRangePicker now and will not lose focus and will not allow keyboard control in the calendar. Are you looking for such component?

@lamhungypl
Copy link
Author

@dmtrKovalenko yep, I have thought about interacting with the calendar by arrow keyboard, but the DateRangepicker's behavior is still fine. Waiting for new release.

I want to custom DatePicker something like:

  • Don't need the Adornment Icon, control hide/show calenda by focus and blur input.
  • Validate input date value, error message when lose focus (blur) input or pick a date from calendar
  • Value highlight in calendar can be set while typing (or when blur,doesn't matter, as long as correct input value can shown in calendar )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: incomplete Need more information
Projects
None yet
Development

No branches or pull requests

3 participants