diff --git a/ghost/sodo-search/src/components/PopupModal.js b/ghost/sodo-search/src/components/PopupModal.js
index a62cb377a1..f31cc12224 100644
--- a/ghost/sodo-search/src/components/PopupModal.js
+++ b/ghost/sodo-search/src/components/PopupModal.js
@@ -2,7 +2,7 @@ import Frame from './Frame';
import AppContext from '../AppContext';
import {ReactComponent as SearchIcon} from '../icons/search.svg';
import {ReactComponent as CloseIcon} from '../icons/close.svg';
-import {useContext, useEffect, useRef} from 'react';
+import {useContext, useEffect, useMemo, useRef, useState} from 'react';
import {getBundledCssLink} from '../utils/helpers';
const React = require('react');
@@ -147,6 +147,11 @@ function SearchBox() {
searchValue: e.target.value
});
}}
+ onKeyDown={(e) => {
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
+ e.preventDefault();
+ }
+ }}
className='grow -my-5 py-5 -ml-3 pl-3 text-[1.65rem] focus-visible:outline-none placeholder:text-gray-400'
placeholder='Search posts, tags, authors..'
/>
@@ -175,16 +180,23 @@ function ClearButton() {
);
}
-function TagListItem({tag}) {
- const {name, url} = tag;
+function TagListItem({tag, selectedResult, setSelectedResult}) {
+ const {name, url, id} = tag;
+ let className = 'flex items-center py-3 -mx-4 sm:-mx-7 px-4 sm:px-7 cursor-pointer';
+ if (id === selectedResult) {
+ className += ' bg-neutral-100';
+ }
return (
{
if (url) {
window.location.href = url;
}
}}
+ onMouseEnter={() => {
+ setSelectedResult(id);
+ }}
>
#
{name}
@@ -192,7 +204,7 @@ function TagListItem({tag}) {
);
}
-function TagResults({tags}) {
+function TagResults({tags, selectedResult, setSelectedResult}) {
if (!tags?.length) {
return null;
}
@@ -202,6 +214,7 @@ function TagResults({tags}) {
);
});
@@ -213,29 +226,42 @@ function TagResults({tags}) {
);
}
-function PostListItem({post}) {
- const {title, excerpt, url} = post;
+function PostListItem({post, selectedResult, setSelectedResult}) {
+ const {title, excerpt, url, id} = post;
+ let className = 'py-3 -mx-4 sm:-mx-7 px-4 sm:px-7 cursor-pointer';
+ if (id === selectedResult) {
+ className += ' bg-neutral-100';
+ }
return (
-
{
- if (url) {
- window.location.href = url;
- }
- }}>
+
{
+ if (url) {
+ window.location.href = url;
+ }
+ }}
+ onMouseEnter={() => {
+ setSelectedResult(id);
+ }}
+ >
{title}
{excerpt}
);
}
-function ShowMoreButtom() {
+function ShowMoreButton() {
return (
-