Skip to content

feat(popover-edit): allow tabbing from popup to next/previous cell #15793

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

Merged
merged 1 commit into from
Apr 16, 2019

Conversation

kseamon
Copy link
Collaborator

@kseamon kseamon commented Apr 11, 2019

Includes a demo of how this allows a more spreadsheet-like set of user interactions when combined with some of Popover Edit's other features.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 11, 2019
@kseamon
Copy link
Collaborator Author

kseamon commented Apr 11, 2019

Note that this is rebased over top of #15762 - so so just review the 1a68597 commit changes.

}

private _triggerFormSubmit() {
this.elementRef.nativeElement!.dispatchEvent(new Event('submit'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than "submitting" the form via the DOM, couldn't we call the submit handler ourselves?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could alternatively call .submit() on the form, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do need the form itself to submit in case the user added any submit handlers.

}

protected initFocusTrap(): void {
this.focusTrap = this.focusEscapeNotifierFactory.create(this.overlayRef!.overlayElement);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be cleaned up on destroy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Overlay elements are destroyed, and the focus trap is inside of the overlay bounding box, so I don't think any additional cleanup is needed.

}

private _triggerFormSubmit() {
this.elementRef.nativeElement!.dispatchEvent(new Event('submit'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could alternatively call .submit() on the form, no?

@kseamon
Copy link
Collaborator Author

kseamon commented Apr 15, 2019

Calling .submit() does not work - It submits the form without calling any event handlers (and triggers an old-school page refresh).

@kseamon kseamon force-pushed the popover-edit-spreadsheet-behavior branch from 39be059 to fbe596a Compare April 15, 2019 18:25
@kseamon kseamon marked this pull request as ready for review April 15, 2019 18:26
@kseamon kseamon requested a review from andrewseguin as a code owner April 15, 2019 18:26
@kseamon kseamon force-pushed the popover-edit-spreadsheet-behavior branch from fbe596a to e3cc445 Compare April 15, 2019 19:05
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -30,6 +31,12 @@ export class EditEventDispatcher {
/** A subject that emits mouse move events for table rows. */
readonly mouseMove = new Subject<Element|null>();

/** The EditRef for the currently active edit lens (if any). */
get editRef(): EditRef<any>|null {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be in a follow-up change, but could we avoid using any here in favor of a generic?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be tricky - the type is generic in the lens (refers to the shape of the form data) but different edits in the same table could have different lenses and this must refer to all of them.

It’d be fine to use unknown here but I don’t know what TS versions we have to support.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make it unknown in a follow-up. As of Angular v8 we support 3.4 as the minimum

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Apr 15, 2019
@jelbourn jelbourn merged commit d3d026b into angular:master Apr 16, 2019
RudolfFrederiksen pushed a commit to RudolfFrederiksen/material2 that referenced this pull request Jun 21, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants