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

fix(date-range): projected input focus restore on consecutive close #14951

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

damyanpetev
Copy link
Member

@damyanpetev damyanpetev commented Oct 25, 2024

Related to #14918

The caching of the active projected input is done on focus:

private cacheFocusedInput(): void {
if (this.hasProjectedInputs) {
this.projectedInputs.forEach(i => {
fromEvent(i.dateTimeEditor.nativeElement, 'focus')
.pipe(takeUntil(this._destroy$))
.subscribe(() => this._focusedInput = i);

Which means this handling on close:
if (this.hasProjectedInputs && this._focusedInput) {
this._focusedInput.setFocus();
this._focusedInput = null;
}

Returns the focus to the input (it's cached) and then immediately deletes it, meaning the next open won't have this and won't restore the focus back on close.

The caching should be done on open IMO, but short of refactoring that just moving the cleanup on the actual component-level blur handler.

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

@damyanpetev damyanpetev changed the title fix(date-range): projected input focus restore consecutive close fix(date-range): projected input focus restore on consecutive close Oct 25, 2024
@damyanpetev damyanpetev changed the base branch from master to 18.2.x October 25, 2024 08:16
@jackofdiamond5 jackofdiamond5 added 💥 status: in-test PRs currently being tested ✅ status: verified Applies to PRs that have passed manual verification and removed ❌ status: awaiting-test PRs awaiting manual verification 💥 status: in-test PRs currently being tested labels Nov 12, 2024
@damyanpetev damyanpetev merged commit 6aff96c into 18.2.x Nov 14, 2024
5 checks passed
@damyanpetev damyanpetev deleted the dpetev/date-range-consecutive-close-focus branch November 14, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants