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

[HxInputDate] FocusAsync() not working + other indirect input-components might be also affected #791

Closed
hakenr opened this issue Apr 16, 2024 Discussed in #785 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@hakenr
Copy link
Member

hakenr commented Apr 16, 2024

Discussed in #785

Originally posted by chobo2 April 4, 2024
Hi

I am trying to use "FocusAsync" but it never focuses on it.

I tried taking the default code and added a reference

<HxInputDate Label="Date" @bind-Value="@value" @ref="testInputDate" />

@code {
    public DateTime value { get; set; }
   private HxInputDate<DateTime> testInputDate;
   protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
              testInputDate().FocusAsync()
        }
    }
}

In my actual application I get an error telling me that it can't be done after first render or soemthing like that though it could be because the HxInputDate is in a child component but since I can't even get it working with the example code I thought I would start there.

Also on a side note, is there away to get the calendar to put when you tab into a HxInputDate?

@hakenr hakenr added the bug Something isn't working label Apr 16, 2024
@hakenr hakenr self-assigned this Apr 16, 2024
@hakenr
Copy link
Member Author

hakenr commented Apr 16, 2024

Some input-components use indirect setup where the input-element to be focused is contained in internal component being wrapped by the HxInputBase<>-derived component itself.

The HxInputBase<>.FocusAsync() call has to be passed to the underlying internal component and the contained input-element.

  • HxInputDate
  • HxInputDateRange
  • HxAutosuggest
  • HxMultiSelect
  • HxInputTags
  • HxSearchBox

@chobo2
Copy link

chobo2 commented Jun 14, 2024

Some input-components use indirect setup where the input-element to be focused is contained in internal component being wrapped by the HxInputBase<>-derived component itself.

The HxInputBase<>.FocusAsync() call has to be passed to the underlying internal component and the contained input-element.

  • HxInputDate
  • HxInputDateRange
  • HxAutosuggest
  • HxMultiSelect
  • HxInputTags
  • HxSearchBox

Thanks for checking into this, I just saw this message now.

I did try in the latest version and confirm the cursor does now start in that box.

Is it possible to set it to popup the calendar as well? I can't get the calendar to popup when I tab into those boxes or if I do this FocusAsync() which leads to having to do a secondary click.

hakenr added a commit that referenced this issue Jun 27, 2024
…mponents might be also affected - opening dropdown when focused
@hakenr
Copy link
Member Author

hakenr commented Jun 27, 2024

@chobo2 Thanks for the feedback. I added the logic to show the corresponding dropdown when the input is focused with FocusAsync().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants