Skip to content

Commit

Permalink
Portal: set focus on content after search
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Nov 22, 2023
1 parent dd45c73 commit 9211073
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from './SearchBar.module.scss'
import { scrollToAnimation } from '../parts/Layout'
import { getIndexName } from '../../uilib/search/searchHelpers'
import { applyPageFocus } from '@dnb/eufemia/src/shared/helpers'

const indexName = getIndexName()
const algoliaApplicationID = 'SLD6KEYMQ9'
Expand Down Expand Up @@ -51,9 +52,11 @@ export const SearchBarInput = () => {
showIndicator()
}

const onChangeHandler = ({ data }) => {
const onChangeHandler = ({ data, emptyData }) => {
try {
navigate(`/${data.hit.slug}`.replace('//', '/'))
emptyData()
applyPageFocus('content')
} catch (e) {
setStatus(e.message)
}
Expand Down

0 comments on commit 9211073

Please sign in to comment.