Skip to content

Commit 6eb45db

Browse files
committed
fix(plugins/plugin-client-common): RadioTable should scroll the selected row into view on render
Fixes #5781
1 parent 43c3d9a commit 6eb45db

File tree

1 file changed

+7
-1
lines changed
  • plugins/plugin-client-common/src/components/spi/RadioTable/impl

1 file changed

+7
-1
lines changed

plugins/plugin-client-common/src/components/spi/RadioTable/impl/Carbon.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ export default class CarbonRadioTable extends React.PureComponent<Props, State>
148148
data-key={typeof cell !== 'string' ? cell.key : undefined}
149149
className={`kui--radio-table-cell ${radioTableHintsAsCss(cell) || ''}`}
150150
>
151-
<span data-tag={badgeHint ? 'badge' : undefined}>
151+
<span
152+
data-tag={badgeHint ? 'badge' : undefined}
153+
ref={
154+
isSelected &&
155+
(c => c && (c['scrollIntoViewIfNeeded'] ? c['scrollIntoViewIfNeeded']() : c.scrollIntoView(true)))
156+
}
157+
>
152158
{badgeHint && <span data-tag="badge-circle" className={badgeHint.toString()} />}
153159

154160
<span className="kui--cell-inner-text">{radioTableCellToString(cell)}</span>

0 commit comments

Comments
 (0)