Copilot commented on code in PR #9334:
URL: https://github.com/apache/texera/pull/9334#discussion_r4532724345


##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.html:
##########
@@ -487,6 +487,64 @@ <h2>{{ instructionTitle || "How to use this" }}</h2>
       </div>
     </section>
 
+    <!-- The results this page can show, listed right under the preview since 
both are about the same
+         steps: one chip each, carrying the step's name and an eye. A reader 
with nothing to choose
+         from sees no section; an author always does, with the hint on how to 
add steps. The chips are
+         tracked by step, not by object: a change rebuilds the choices as new 
objects, and re-created
+         buttons would drop the keyboard focus from the chip just pressed. -->
+    <section
+      class="card respick"
+      *ngIf="authoring || resultChoices.length > 0">
+      <h3>Results shown here</h3>
+      <p>
+        {{ authoring ? "Click a name to look at that step; the eye sets 
whether its result shows for everyone. Until you
+        choose, every final step is on, and an earlier step needs its result 
view on the canvas first." : "Click a name
+        to bring its result to the top, and again to let the step go. The eye 
hides a result from your page only." }}
+      </p>
+      <div class="opts">
+        <!-- Two buttons in one chip: the name reaches the result (and the 
step it came from), the
+             eye decides whether it shows. Separate targets, so neither click 
has a second meaning
+             depending on a mode (#9033). -->
+        <div
+          class="pill"
+          *ngFor="let choice of resultChoices; trackBy: trackByChoice"
+          [class.on]="choice.shown"
+          [class.lead-result]="leadsResults(choice.operatorID)">
+          <!-- A hidden result has no card to bring to the top, so its name 
does nothing and does
+               not react to the pointer. Marked unavailable rather than 
disabled, so it keeps its
+               place in the tab order and says why instead of going silent -- 
the eye beside it is
+               live, and that is how the result comes back.
+               `aria-current` carries what the ring shows: which result is the 
one being looked at,
+               for a reader who does not see the ring. -->
+          <button
+            type="button"
+            class="pill-name"
+            [attr.aria-disabled]="!choice.shown"
+            [attr.aria-current]="leadsResults(choice.operatorID)"
+            [attr.title]="choice.shown ? null : 'Hidden. Turn its eye on to 
show this result.'"
+            (click)="onChoiceClick(choice)">
+            {{ choice.label }}
+          </button>
+          <button
+            type="button"
+            class="pill-eye"
+            [attr.aria-pressed]="choice.shown"
+            [attr.aria-label]="(choice.shown ? 'Hide ' : 'Show ') + 
choice.label"

Review Comment:
   The accessible name changes between “Hide …” and “Show …” while 
`aria-pressed` describes whether the result is shown, so a shown result is 
announced as “Hide Limit, pressed”. Keep the label constant, for example `'Show 
' + choice.label`, so the name and pressed state agree, as in 
`editable-label-wrapper.component.html:35–44`. Update the rendered test's “Hide 
Limit” expectation as well.



##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.scss:
##########
@@ -1077,30 +1086,88 @@ $shell: #fafafa;
     gap: 8px;
   }
 
+  /* One result, two things to do with it: the name reaches it, the eye 
decides whether it shows.
+     Two buttons rather than one with a mode, so a click always means the same 
thing (#9033). They
+     share a border so the pair still reads as one chip. */
   .pill {
-    padding: 5px 12px;
+    display: inline-flex;
+    align-items: stretch;
     border-radius: 15px;
     font-size: 13px;
     border: 1px solid $border;
     background: #fff;
     color: $text-2;
-    cursor: pointer;
+    overflow: hidden;
 
-    &:hover {
-      border-color: $blue;
-      color: $blue;
+    button {
+      appearance: none;
+      border: 0;
+      background: none;
+      color: inherit;
+      font: inherit;
+      cursor: pointer;
+
+      &:focus-visible {
+        outline: 2px solid $blue;
+        outline-offset: -2px;
+      }
     }
 
-    &:focus-visible {
-      outline: 2px solid $blue;
-      outline-offset: 2px;
+    .pill-name {
+      padding: 5px 11px;
+
+      &:hover:not([aria-disabled="true"]) {
+        color: $blue;
+      }
+
+      /* Hidden: there is no card to bring to the top, so the name neither 
reacts nor invites. */
+      &[aria-disabled="true"] {
+        cursor: default;
+        opacity: 0.55;
+      }
+    }
+
+    /* Its own segment, with a rule between: a target to aim at rather than an 
icon tucked into the
+       corner of the name's button. */
+    .pill-eye {
+      padding: 5px 10px;
+      font-size: 13px;
+      border-left: 1px solid $border;
+      opacity: 0.65;
+
+      &:hover {
+        color: $blue;
+        background: rgba(24, 144, 255, 0.08);
+        opacity: 1;
+      }
+    }

Review Comment:
   The inherited icon colors and opacity give the hidden eye about 2.06:1 
contrast and the shown eye about 2.48:1, below the 3:1 minimum for control 
icons. The eye is the only active control that can restore a hidden result, so 
dimming it makes that action hard to identify. Use a darker icon color in both 
states and on hover; removing opacity alone still leaves the shown blue eye 
below 3:1.



##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts:
##########
@@ -1331,7 +1331,44 @@ export class WorkflowFormComponent implements OnInit, 
OnDestroy {
    * permanent "No result yet.".
    */
   public get resultIdsToShow(): string[] {
-    return this.shownResultIds.filter(id => 
this.workflowResultService.hasNonEmptyResult(id));
+    const ids = this.shownResultIds.filter(id => 
this.workflowResultService.hasNonEmptyResult(id));
+    // The selected step's card leads; the rest keep the saved order. Moving 
the card rather than
+    // scrolling to it keeps the preview the reader is clicking on in view. 
Read from the selection
+    // rather than kept beside it: two of them drifted apart (hiding the 
selected step's result
+    // cleared the lead but not the selection, and its name then read as 
"already leading" and let
+    // the step go instead of bringing the card back).
+    const lead = this.selectedOperatorId;
+    return lead !== undefined && ids.includes(lead) ? [lead, ...ids.filter(id 
=> id !== lead)] : ids;

Review Comment:
   When this reordering moves a chart card, Angular moves its existing DOM 
nodes, which reloads the chart's `srcdoc` iframe and loses zoom, pan, and 
legend choices. Selecting another step or deselecting can therefore reset a 
chart the reader was inspecting, even though its result data has not changed. 
Keep live chart frames attached during reordering, or preserve their 
interaction state across the reload.



##########
frontend/src/app/workspace/component/workflow-form/workflow-form.component.ts:
##########
@@ -1331,7 +1331,44 @@ export class WorkflowFormComponent implements OnInit, 
OnDestroy {
    * permanent "No result yet.".
    */
   public get resultIdsToShow(): string[] {
-    return this.shownResultIds.filter(id => 
this.workflowResultService.hasNonEmptyResult(id));
+    const ids = this.shownResultIds.filter(id => 
this.workflowResultService.hasNonEmptyResult(id));
+    // The selected step's card leads; the rest keep the saved order. Moving 
the card rather than
+    // scrolling to it keeps the preview the reader is clicking on in view. 
Read from the selection
+    // rather than kept beside it: two of them drifted apart (hiding the 
selected step's result
+    // cleared the lead but not the selection, and its name then read as 
"already leading" and let
+    // the step go instead of bringing the card back).
+    const lead = this.selectedOperatorId;
+    return lead !== undefined && ids.includes(lead) ? [lead, ...ids.filter(id 
=> id !== lead)] : ids;
+  }
+
+  /** Whether this step's card is at the front because it is the selected one 
-- what the ring marks,
+   *  on the card and on the step's chip. False for the usual first card. */
+  public leadsResults(operatorID: string): boolean {
+    return this.selectedOperatorId === operatorID && this.resultIdsToShow[0] 
=== operatorID;
+  }
+
+  /**
+   * A result's name, in either mode: a click selects that step, the same 
selection clicking the step
+   * on the preview makes -- through the action service, so co-editors see the 
ring as they do for a
+   * canvas click -- and its card comes to the front, ringed. Two steps with 
the same name are told
+   * apart by which one lights up. Clicking the name of the step already 
selected lets it go, putting
+   * the cards back. Nothing is written either way.
+   *
+   * A hidden result has no card to bring to the top, so its name does nothing 
at all: the template
+   * marks it unavailable, and this ignores it in case it is reached another 
way.
+   *
+   * The preview is left as the reader had it: opening it from here moved the 
results a third of the
+   * page down, out from under the name just clicked (#9033).
+   */
+  public onChoiceClick(choice: ResultChoice): void {
+    if (!choice.shown) {
+      return;
+    }
+    if (this.selectedOperatorId === choice.operatorID) {
+      this.closeOperatorPanel();
+      return;
+    }
+    this.workflowActionService.highlightOperators(false, choice.operatorID);

Review Comment:
   After Shift-selecting A and B in the preview, clicking either result name 
leaves both selected and no card leading: the wrapper ignores an 
already-highlighted ID before clearing the other highlights. Clear the current 
operator selection when it contains the requested step before highlighting it 
again. Model this early return in `workflow-form.spec-harness.ts:127` and add a 
regression test for that transition.



-- 
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]

Reply via email to