diff --git a/src/library-authoring/generic/history-widget/messages.ts b/src/library-authoring/generic/history-widget/messages.ts
index b0c84a85e7..4b0176a90c 100644
--- a/src/library-authoring/generic/history-widget/messages.ts
+++ b/src/library-authoring/generic/history-widget/messages.ts
@@ -1,6 +1,11 @@
import { defineMessages } from '@edx/frontend-platform/i18n';
const messages = defineMessages({
+ lastPublishedTitle: {
+ id: 'course-authoring.library-authoring.generic.history-widget.last-published',
+ defaultMessage: 'Last Published',
+ description: 'Title of the last published section in the library authoring sidebar.',
+ },
lastModifiedTitle: {
id: 'course-authoring.library-authoring.generic.history-widget.last-modified',
defaultMessage: 'Last Modified',
diff --git a/src/search-manager/SearchKeywordsField.tsx b/src/search-manager/SearchKeywordsField.tsx
index 14a6a06dc9..90c09fdd93 100644
--- a/src/search-manager/SearchKeywordsField.tsx
+++ b/src/search-manager/SearchKeywordsField.tsx
@@ -7,7 +7,11 @@ import { useSearchContext } from './SearchManager';
/**
* The "main" input field where users type in search keywords. The search happens as they type (no need to press enter).
*/
-const SearchKeywordsField: React.FC<{ className?: string, placeholder?: string }> = (props) => {
+const SearchKeywordsField: React.FC<{
+ className?: string,
+ placeholder?: string,
+ autoFocus?: boolean,
+}> = (props) => {
const intl = useIntl();
const { searchKeywords, setSearchKeywords, usageKey } = useSearchContext();
const defaultPlaceholder = usageKey ? messages.clearUsageKeyToSearch : messages.inputPlaceholder;
@@ -24,7 +28,7 @@ const SearchKeywordsField: React.FC<{ className?: string, placeholder?: string }
>
diff --git a/src/search-manager/data/api.ts b/src/search-manager/data/api.ts
index 0763000f55..28822071a6 100644
--- a/src/search-manager/data/api.ts
+++ b/src/search-manager/data/api.ts
@@ -473,9 +473,9 @@ export async function fetchTagsThatMatchKeyword({
attributesToSearchOn: ['tags.taxonomy', 'tags.level0', 'tags.level1', 'tags.level2', 'tags.level3'],
attributesToRetrieve: ['tags'],
limit,
- // We'd like to use 'showMatchesPosition: true' to know exactly which tags match, but it doesn't provide the
- // detail we need; it's impossible to tell which tag at a given level matched based on the returned _matchesPosition
- // data - https://github.com/orgs/meilisearch/discussions/550
+ // TODO: improve this - use 'showMatchesPosition: true' to know exactly which tags match. Previously it didn't
+ // provide the detail we need (https://github.com/orgs/meilisearch/discussions/550) but it has now been implemented
+ // in newer versions of Meilisearch. See https://github.com/meilisearch/meilisearch/pull/5005 which fixes it.
});
const tagSearchKeywordsLower = tagSearchKeywords.toLocaleLowerCase();
diff --git a/src/search-modal/SearchModal.test.tsx b/src/search-modal/SearchModal.test.tsx
index ef35726395..c7884fbf8c 100644
--- a/src/search-modal/SearchModal.test.tsx
+++ b/src/search-modal/SearchModal.test.tsx
@@ -5,7 +5,7 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { AppProvider } from '@edx/frontend-platform/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
-import { render } from '@testing-library/react';
+import { render, screen } from '@testing-library/react';
import type { Store } from 'redux';
import MockAdapter from 'axios-mock-adapter';
@@ -73,4 +73,14 @@ describe('
', () => {
const { findByText } = render(
);
expect(await findByText('An error occurred. Unable to load search results.')).toBeInTheDocument();
});
+
+ it('should set focus on the search input box when loaded in the modal', async () => {
+ axiosMock.onGet(getContentSearchConfigUrl()).replyOnce(200, {
+ url: 'https://meilisearch.example.com',
+ index: 'test-index',
+ apiKey: 'test-api-key',
+ });
+ render(
);
+ expect(screen.getByRole('searchbox')).toHaveFocus();
+ });
});
diff --git a/src/search-modal/SearchModal.tsx b/src/search-modal/SearchModal.tsx
index 2e552fb6e8..197ba6c708 100644
--- a/src/search-modal/SearchModal.tsx
+++ b/src/search-modal/SearchModal.tsx
@@ -21,7 +21,11 @@ const SearchModal: React.FC<{ courseId?: string, isOpen: boolean, onClose: () =>
isFullscreenOnMobile
className="courseware-search-modal"
>
-
+
);
};
diff --git a/src/search-modal/SearchUI.tsx b/src/search-modal/SearchUI.tsx
index 2df074111c..a70e1f69fe 100644
--- a/src/search-modal/SearchUI.tsx
+++ b/src/search-modal/SearchUI.tsx
@@ -19,7 +19,11 @@ import EmptyStates from './EmptyStates';
import SearchResults from './SearchResults';
import messages from './messages';
-const SearchUI: React.FC<{ courseId?: string, closeSearchModal?: () => void }> = (props) => {
+const SearchUI: React.FC<{
+ courseId?: string,
+ autoFocus?: boolean,
+ closeSearchModal?: () => void,
+}> = (props) => {
const hasCourseId = Boolean(props.courseId);
const [searchThisCourseEnabled, setSearchThisCourse] = React.useState(hasCourseId);
const switchToThisCourse = React.useCallback(() => setSearchThisCourse(true), []);
@@ -39,7 +43,10 @@ const SearchUI: React.FC<{ courseId?: string, closeSearchModal?: () => void }> =
-
+