bito-code-review[bot] commented on code in PR #42078:
URL: https://github.com/apache/superset/pull/42078#discussion_r3652241105
##########
superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/ItemTitleContainer.tsx:
##########
@@ -159,19 +158,25 @@ const ItemTitleContainer = forwardRef<HTMLDivElement,
Props>(
<StyledWarning className="warning" iconSize="s" />
)}
{isRemoved && (
- <span
- css={{ alignSelf: 'flex-end', marginLeft: 'auto' }}
- role="button"
+ <button
+ type="button"
+ css={css`
+ appearance: none;
+ border: none;
+ background: none;
+ padding: 0;
+ font: inherit;
+ align-self: flex-end;
+ margin-left: auto;
+ `}
data-test="undo-button"
- tabIndex={0}
onClick={e => {
e.preventDefault();
restoreItem(id);
}}
- onKeyDown={handleKeyboardActivation(() => restoreItem(id))}
>
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Keyboard repeat handler missing</b></div>
<div id="fix">
The new `<button>` is missing the `onKeyDown` handler that prevented
duplicate callbacks on key hold. The original `<span role="button">` had
`handleKeyboardActivation(() => restoreItem(id))` which checked `event.repeat`
to ignore auto-repeat keydown events. Without this, holding Enter/Space fires
multiple undo calls in rapid succession. Re-add the import and handler to match
the original behavior.
</div>
</div>
<div><details><summary><b>Review Rule</b></summary><div>Bito created the
rule <strong><code>Prevent duplicate keyboard activation on
buttons</code></strong> for <strong>repo:</strong>
<code>apache/superset</code>, <strong>language:</strong> <code>TSX</code>. Bito
will avoid suggestions that match this rule. You can manage review rules <a
href=https://alpha.bito.ai/home/ai-agents/review-rules>here</a>.</div></details></div>
<small><i>Code Review Run #7d4b9d</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]