Skip to content
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

PG-592: Adding focus ring prop to control non-interactive focusable element #1256

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,7 @@ export class GalleryContainer extends React.Component {
galleryContainerId={`pro-gallery-container-${this.props.id}`}
scrollTop={this.state?.scrollPosition?.top}
isScrollLessGallery={this.getIsScrollLessGallery(this.state.options)}
shouldDisableItemFocus={this.props.shouldDisableItemFocus}
actions={{
...this.props.actions,
findNeighborItem: this.findNeighborItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class GalleryView extends React.Component {
...galleryConfig,
visible: item.isVisible,
key: `itemView-${item.id}-${index}`,
shouldDisableItemFocus: this.props.shouldDisableItemFocus,
});
return React.createElement(itemView, {
...itemProps,
Expand Down
4 changes: 3 additions & 1 deletion packages/gallery/src/components/item/itemView.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,9 @@ class ItemView extends React.Component {
}

getItemContainerTabIndex() {
const tabIndex = this.isHighlight()
const tabIndex = this.props.shouldDisableItemFocus
? -1
: this.isHighlight()
? utils.getTabIndex('currentThumbnail')
: this.props.activeIndex === this.props.idx
? utils.getTabIndex('currentGalleryItem')
Expand Down
1 change: 1 addition & 0 deletions packages/lib/src/common/interfaces/galleryTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface GalleryProps {
isInDisplay?: boolean;
enableExperimentalFeatures?: boolean;
virtualizationSettings?: VirtualizationSettings;
shouldDisableItemFocus?: boolean;
}

export interface GalleryState {
Expand Down
Loading