-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ListView UI bug fixes and updates #2804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1d49a64
4420acc
8fdfef9
72b674b
7ee30d1
4512b88
cf41f67
9a2d3f7
d172d78
06f93e6
2011fae
1767089
5c6ea85
24af3c6
d5e4a94
9b63316
eebb2b5
2aab429
70a4fc7
c0725e8
cc7a836
a344906
ac3c4cb
db50827
cfdc2d4
594013a
eb50f41
e42de7b
4bebdf2
4252b28
509e005
fc1b79c
3e914dc
e73c49d
83505c1
5fba763
d684ffc
112276b
6901cf7
0c72b90
1773747
3144468
2eaa09c
079512a
d2940ec
ee97f27
6999781
b776da4
5ed63b5
276c282
718ba65
458ecf6
2c0e8b1
11770b6
f9c6081
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ export function layoutInfoToStyle(layoutInfo: LayoutInfo, dir: Direction, parent | |
| opacity: layoutInfo.opacity, | ||
| zIndex: layoutInfo.zIndex, | ||
| transform: layoutInfo.transform, | ||
| contain: layoutInfo.allowOverflow ? 'size layout style' : 'size layout style paint' | ||
| contain: 'size layout style' | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixes issue with sticky checkboxes and focus indicator not sticking properly in Safari 15.4. Don't think we need |
||
| }; | ||
|
|
||
| cache.set(layoutInfo, style); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,8 @@ export function ListViewItem(props) { | |
| dragHooks | ||
| } = props; | ||
| let cellNode = [...item.childNodes][0]; | ||
| let {state, dragState, onAction, isListDraggable} = useContext(ListViewContext); | ||
| let {state, dragState, onAction, isListDraggable, layout} = useContext(ListViewContext); | ||
|
|
||
| let {direction} = useLocale(); | ||
| let rowRef = useRef<HTMLDivElement>(); | ||
| let cellRef = useRef<HTMLDivElement>(); | ||
|
|
@@ -97,9 +98,30 @@ export function ListViewItem(props) { | |
| let isSelected = state.selectionManager.isSelected(item.key); | ||
| let showDragHandle = isDraggable && isFocusVisibleWithin; | ||
| let {visuallyHiddenProps} = useVisuallyHidden(); | ||
| let isFirstRow = item.prevKey == null; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought ListView did items not rows?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it uses |
||
| let isLastRow = item.nextKey == null; | ||
| // Figure out if the ListView content is equal or greater in height to the container. If so, we'll need to round the bottom | ||
| // border corners of the last row when selected and we can get rid of the bottom border if it isn't selected to avoid border overlap | ||
| // with bottom border | ||
| let isFlushWithContainerBottom = false; | ||
| if (isLastRow) { | ||
| if (layout.getContentSize()?.height >= layout.virtualizer?.getVisibleRect().height) { | ||
| isFlushWithContainerBottom = true; | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <div | ||
| {...mergeProps(rowProps, pressProps, isDraggable && draggableItem?.dragProps)} | ||
| className={ | ||
| classNames( | ||
| listStyles, | ||
| 'react-spectrum-ListView-row', | ||
| { | ||
| 'focus-ring': isFocusVisible | ||
| } | ||
| ) | ||
| } | ||
| ref={rowRef}> | ||
| <div | ||
| className={ | ||
|
|
@@ -112,9 +134,12 @@ export function ListViewItem(props) { | |
| 'focus-ring': isFocusVisible, | ||
| 'is-hovered': isHovered, | ||
| 'is-selected': isSelected, | ||
| 'is-previous-selected': state.selectionManager.isSelected(item.prevKey), | ||
| 'is-next-selected': state.selectionManager.isSelected(item.nextKey), | ||
| 'react-spectrum-ListViewItem--highlightSelection': state.selectionManager.selectionBehavior === 'replace' && (isSelected || state.selectionManager.isSelected(item.nextKey)), | ||
| 'react-spectrum-ListViewItem--draggable': isDraggable | ||
| 'react-spectrum-ListViewItem--draggable': isDraggable, | ||
| 'react-spectrum-ListViewItem--firstRow': isFirstRow, | ||
| 'react-spectrum-ListViewItem--lastRow': isLastRow, | ||
| 'react-spectrum-ListViewItem--isFlushBottom': isFlushWithContainerBottom | ||
| } | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately cannot omit the bottom border of the last row like we do in ListView due to how the row vs cell is structured (aka row is 1px larger than the cell, controlled by layout, cell is responsible for filling in the background color, cell focus ring cut off if we reduce the row height, etc). Can be investigated further as follow up