From 0fe77a8068a56d4d16b62dea52e799c0fd1eb394 Mon Sep 17 00:00:00 2001
From: David <33458145+davidmcpowell@users.noreply.github.com>
Date: Thu, 30 Jul 2026 10:12:00 +0100
Subject: [PATCH] Merge pull request #35964 from
overleaf/dp-dark-library-autocomplete
Add dark theme support to the library auto-complete dropdown
GitOrigin-RevId: be975d7c379e689ed61706bf027e488b7177eb73
---
.../shared/components/ol/ol-autocomplete.tsx | 5 +-
.../stylesheets/components/autocomplete.scss | 5 ++
.../shared/ol-autocomplete.spec.tsx | 62 +++----------------
3 files changed, 19 insertions(+), 53 deletions(-)
diff --git a/services/web/frontend/js/shared/components/ol/ol-autocomplete.tsx b/services/web/frontend/js/shared/components/ol/ol-autocomplete.tsx
index d6efd94545..8e718b7e10 100644
--- a/services/web/frontend/js/shared/components/ol/ol-autocomplete.tsx
+++ b/services/web/frontend/js/shared/components/ol/ol-autocomplete.tsx
@@ -216,7 +216,9 @@ function OLAutocompleteInternal({
'dropdown-item-highlighted': highlightedIndex === index,
})}
>
- {createOptionPrefix}
+
+ {createOptionPrefix}{' '}
+
'{internalInputValue}'
@@ -245,6 +247,7 @@ function OLAutocompleteInternal({
{...getInputProps({
ref: inputRef,
})}
+ type="text"
placeholder={placeholder}
disabled={disabled}
/>
diff --git a/services/web/frontend/stylesheets/components/autocomplete.scss b/services/web/frontend/stylesheets/components/autocomplete.scss
index 96e6ee3ba2..f00e8d090a 100644
--- a/services/web/frontend/stylesheets/components/autocomplete.scss
+++ b/services/web/frontend/stylesheets/components/autocomplete.scss
@@ -1,4 +1,9 @@
.ol-autocomplete {
+ .form-label,
+ .ol-autocomplete-create-prefix {
+ color: var(--content-secondary-themed);
+ }
+
.dropdown-menu {
position: relative;
top: 0;
diff --git a/services/web/test/frontend/components/shared/ol-autocomplete.spec.tsx b/services/web/test/frontend/components/shared/ol-autocomplete.spec.tsx
index 39d50172b1..0cde3587c4 100644
--- a/services/web/test/frontend/components/shared/ol-autocomplete.spec.tsx
+++ b/services/web/test/frontend/components/shared/ol-autocomplete.spec.tsx
@@ -450,57 +450,7 @@ describe('', function () {
describe('form integration', function () {
it('works within a form context', function () {
- const FormWithAutocomplete = ({
- onSubmit,
- }: {
- onSubmit: (formData: object) => void
- }) => {
- const changeHandler = cy.stub().as('formChangeHandler')
-
- function handleSubmit(event: FormEvent) {
- event.preventDefault()
- const formData = new FormData(event.target as HTMLFormElement)
- onSubmit(Object.fromEntries(formData.entries()))
- }
-
- return (
-
- {
- if (ref) {
- // Update hidden input when autocomplete changes
- const observer = new MutationObserver(() => {
- const autocompleteInput = ref.form?.querySelector(
- 'input[type="text"]'
- ) as HTMLInputElement
- if (autocompleteInput) {
- ref.value = autocompleteInput.value
- }
- })
- if (ref.form) {
- observer.observe(ref.form, {
- subtree: true,
- attributes: true,
- })
- }
- }
- }}
- />
-
- submit
-
- )
- }
-
- const submitHandler = cy.stub().as('submitHandler')
+ const changeHandler = cy.stub().as('formChangeHandler')
cy.mount(
', function () {
height: '100vh',
}}
>
-
+
+
+ submit
+
)