Gr-change-list should not put focus selected it hasn't changed
This was pulling away focus from the search-bar if change-list-items
took longer to load than when the user starts typing (which can happen
on dashboards with lots of changes).
Only focus if selected is true *and* it was changed.
Google-Bug-Id: b/259615565
Release-Notes: skip
Change-Id: Ic5d22a608791a278d6efb8cee430df669fc824c9
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts
index d9982b1..06336c9 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts
@@ -156,7 +156,7 @@
override willUpdate(changedProperties: PropertyValues<this>) {
// When the cursor selects this item, give it focus so that the item is read
// out by screen readers and lets users start tabbing through the item
- if (this.selected && !changedProperties.get('selected')) {
+ if (this.selected && changedProperties.has('selected')) {
this.focus();
}
}