yangzhang75 commented on code in PR #8839:
URL: https://github.com/apache/texera/pull/8839#discussion_r4309407350
##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts:
##########
@@ -563,6 +563,23 @@ export class WorkflowFormComponent implements OnInit,
OnDestroy {
*/
@HostListener("focusout")
public onFocusOut(): void {
+ this.flushHeldRebuild();
+ }
+
+ /**
+ * A click or a key inside the page also ends a hold, because a focus change
is not the only thing
+ * that does: closing an nz-select leaves the focus in its search box
(ng-zorro re-focuses it), so
+ * no focusout fires, and a rebuild held while the list was open would have
waited for an unrelated
+ * event (Copilot on #8839). The same later() re-check as below decides it
after the current tick,
+ * by when the dropdown has lost its open class.
+ */
+ @HostListener("click")
Review Comment:
Confirmed: the options are drawn in the CDK overlay container, a sibling of
the app, so the click that picks one never bubbles through this host -- and
picking the option already chosen changes no value and moves no focus either,
so nothing was left to end the hold.
The click now comes off the document; a click anywhere ends a hold for the
same reason a focusout does, and the handler returns at once unless one is
actually held. Keys stay on the host: what is typed goes into controls this
page owns (nz-select keeps its search box in the trigger, not the overlay), and
a document-wide key listener would run on every keystroke in the workspace.
Regression test as asked, in the rendered spec: a real
`.cdk-overlay-container` built outside the fixture, an option clicked in it,
with the test first asserting the host does not contain that option.
Deletion-checked both ways -- putting the listener back on the host turns the
new test red, removing it turns that and the in-page one red. Pushed as
0e2517ad6.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]