Skip to content

Commit

Permalink
Added autoFocus prop to PageViews
Browse files Browse the repository at this point in the history
Enact-DCO-1.0-Signed-off-by: Hyelyn Kim (myelyn.kim@lge.com)
  • Loading branch information
mmyelyn committed Oct 8, 2024
1 parent 94ebdbb commit dc02610
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The following is a curated list of changes in the Enact sandstone module, newest
### Added

- `sandstone/Alert` public class names `alert`, `content`, `fullscreen`, and `title`
- `sandstone/PageViews` prop `autoFocus` to set whether focus element automatically or not
- `sandstone/Steps` prop `highlightCurrentOnly` to highlight and scale only the current step

### Changed
Expand All @@ -15,7 +16,6 @@ The following is a curated list of changes in the Enact sandstone module, newest

### Fixed

- `sandstone/PageViews` not to focus element automatically when `autoFocus` prop is set `none`
- `sandstone/Panels.Header` to show title and subtitle properly in `sandstone/WizardPanels`
- `sandstone/Scroller`, `sandstone/Slider`, and `sandstone/VirtualList` to have default prop when `undefined` prop is passed
- `sandstone/Scroller` to show scroll indicator when `focusableScrollbar` prop is `true`
Expand Down
10 changes: 10 additions & 0 deletions PageViews/PageViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ const PageViewsBase = kind({
*/
arranger: shape,

/**
* Sets the strategy used to automatically focus an element within the PageViews upon render.
* When set to 'none', focus is not set only on the first render.
*
* @type {('default-element'|'last-focused'|'none'|String)}
* @default 'default-element'
* @public
*/
autoFocus: PropTypes.string,

/**
* {@link sandstone/PageViews.Page|Page} to be rendered.
*
Expand Down
6 changes: 4 additions & 2 deletions PageViews/PageViewsRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function useReverseTransition (index, rtl) {
*/
function PageViewsRouter (Wrapped) {
const PageViewsProvider = ({
autoFocus = 'default-element',
autoFocus,
children,
componentRef,
'data-spotlight-id': spotlightId,
Expand Down Expand Up @@ -70,9 +70,11 @@ function PageViewsRouter (Wrapped) {
PageViewsProvider.propTypes = /** @lends sandstone/PageViews.PageViewsRouter.prototype */ {
/**
* Sets the strategy used to automatically focus an element within the PageViews upon render.
* When set to 'none', focus is not set only on the first render.
*
* @type {('default-element'|'last-focused'|'none'|String)}
* @public
* @default 'default-element'
* @private
*/
autoFocus: PropTypes.string,

Expand Down

0 comments on commit dc02610

Please sign in to comment.