diff --git a/doc/changelog.d/542.fixed.md b/doc/changelog.d/542.fixed.md new file mode 100644 index 00000000..1e0f3ea2 --- /dev/null +++ b/doc/changelog.d/542.fixed.md @@ -0,0 +1 @@ +fix: add default `enter` for search \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 20c576cc..0c04e25d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "flit_core.buildapi" [project] # Check https://flit.readthedocs.io/en/latest/pyproject_toml.html for all available sections name = "ansys-sphinx-theme" -version = "1.1.2" +version = "1.1.3" description = "A theme devised by ANSYS, Inc. for Sphinx documentation." readme = "README.rst" requires-python = ">=3.10,<4" diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/js/fuse_search.js b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/js/fuse_search.js index 68fd83b3..ae05e682 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/js/fuse_search.js +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/js/fuse_search.js @@ -111,13 +111,10 @@ require(["fuse"], function (Fuse) { switch (event.key) { case "Enter": - event.preventDefault(); // Prevent form submission if (currentIndex >= 0 && currentIndex < resultItems.length) { + event.preventDefault(); // Prevent default enter action const href = resultItems[currentIndex].getAttribute("data-href"); navigateToHref(href); - } else if (resultItems.length > 0) { - const href = resultItems[0].getAttribute("data-href"); - navigateToHref(href); } break;