Skip to content

Commit 122ad8d

Browse files
author
Akos Kitta
committed
Last item's <select> must be visible.
Closes #1387 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 1d0f641 commit 122ad8d

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Diff for: arduino-ide-extension/src/browser/widgets/component-list/component-list-item.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class ComponentListItem<
3232
const { item, itemRenderer } = this.props;
3333
return (
3434
<div
35-
onMouseEnter={() => this.setState({ focus: true })}
35+
onMouseOver={() => this.setState({ focus: true })}
3636
onMouseLeave={() => this.setState({ focus: false })}
3737
>
3838
{itemRenderer.renderItem(

Diff for: arduino-ide-extension/src/browser/widgets/component-list/component-list.tsx

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'react-virtualized/styles.css';
12
import * as React from '@theia/core/shared/react';
23
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
34
import {
@@ -59,7 +60,7 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
5960
this.mostRecentWidth = width;
6061
return (
6162
<List
62-
className={'items-container'}
63+
className="items-container"
6364
rowRenderer={this.createItem}
6465
height={height}
6566
width={width}
@@ -88,7 +89,7 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
8889
}
8990
}
9091

91-
private setListRef = (ref: List | null): void => {
92+
private readonly setListRef = (ref: List | null): void => {
9293
this.list = ref || undefined;
9394
};
9495

@@ -106,14 +107,21 @@ export class ComponentList<T extends ArduinoComponent> extends React.Component<
106107
private clear(index: number): void {
107108
this.cache.clear(index, 0);
108109
this.list?.recomputeRowHeights(index);
109-
// Update the last item if the if the one before was updated
110-
if (index === this.props.items.length - 2) {
111-
this.cache.clear(index + 1, 0);
112-
this.list?.recomputeRowHeights(index + 1);
110+
// The last item need extra space height for the footer on hover.
111+
if (index === this.props.items.length - 1) {
112+
this.list?.recomputeGridSize();
113+
// Scroll to the very end if the last item has the :hover, so that footer will be visible.
114+
const endPosition = this.list?.getOffsetForRow({
115+
index,
116+
alignment: 'end',
117+
});
118+
if (endPosition) {
119+
this.list?.scrollToPosition(endPosition);
120+
}
113121
}
114122
}
115123

116-
private createItem: ListRowRenderer = ({
124+
private readonly createItem: ListRowRenderer = ({
117125
index,
118126
parent,
119127
key,

0 commit comments

Comments
 (0)