diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0ceef41d84..495962d0a3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,6 +39,9 @@ jobs: run: | python -m pip install --upgrade pip setuptools python -m pip install -r requirements/tests.txt + - name: Install playwright browsers + run: | + python -m playwright install --with-deps - name: Set up databases run: | PGPASSWORD="postgres" createuser -U postgres -d djangoproject --superuser -h localhost diff --git a/Dockerfile b/Dockerfile index 2018de0a66..21a3c6a07b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,10 @@ COPY ./requirements ./requirements RUN apt-get update \ && apt-get install --assume-yes --no-install-recommends ${BUILD_DEPENDENCIES} \ && python3 -m pip install --no-cache-dir -r ${REQ_FILE} \ + && if [ "${REQ_FILE}" = "requirements/tests.txt" ]; then \ + echo "Installing Playwright browsers..."; \ + playwright install --with-deps; \ + fi \ && apt-get purge --assume-yes --auto-remove ${BUILD_DEPENDENCIES} \ && apt-get distclean diff --git a/Makefile b/Makefile index 910ce300e4..264d28e86a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ APP_LIST ?= accounts aggregator blog contact dashboard djangoproject docs founda SCSS = djangoproject/scss STATIC = djangoproject/static -ci: compilemessages test +ci: compilemessages collectstatics test @python -m coverage report compilemessages: diff --git a/djangoproject/static/js/djangoproject.js b/djangoproject/static/js/djangoproject.js index b420896d5e..ade61c7de0 100644 --- a/djangoproject/static/js/djangoproject.js +++ b/djangoproject/static/js/djangoproject.js @@ -67,8 +67,12 @@ document.querySelector('.menu-button').addEventListener('click', function () { // Update search input placeholder text based on the user's operating system (function () { - const el = document.getElementById('id_q'); + const inputs = [ + document.getElementById('id_desktop-q'), + document.getElementById('id_mobile-q'), + ]; + const el = inputs.find((el) => el.checkVisibility()); if (!el) { return; } @@ -94,7 +98,13 @@ window.addEventListener('keydown', function (e) { e.preventDefault(); - const el = document.querySelector('#id_q'); + const inputs = [ + document.getElementById('id_desktop-q'), + document.getElementById('id_mobile-q'), + ]; + + const el = inputs.find((el) => el.checkVisibility()); + if (!el) return; el.select(); el.focus(); diff --git a/djangoproject/templates/includes/header.html b/djangoproject/templates/includes/header.html index aa62a1bc14..a9edcf35e8 100644 --- a/djangoproject/templates/includes/header.html +++ b/djangoproject/templates/includes/header.html @@ -1,4 +1,5 @@ {% load docs %} +{% search_context as cached_search_context %} {% if 'preview.djangoproject.com' in request.get_host %}
{% endif %} @@ -7,7 +8,7 @@ Django