Skip to content

Commit

Permalink
PG-592: Adding focus ring prop to control non-interactive focusable e…
Browse files Browse the repository at this point in the history
…lement (#1256)

* adding disable focus ring prop
  • Loading branch information
hadasze authored Jun 26, 2024
1 parent 9de5082 commit 417ee94
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
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

0 comments on commit 417ee94

Please sign in to comment.