Merge pull request #222 from UniversityRadioYork/marks/library-select-focus

Defocus library dropdown when adding item
This commit is contained in:
Matthew Stratford 2021-04-30 21:38:24 +01:00 committed by GitHub
commit 9d318b201c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -170,10 +170,15 @@ const Showplanner: React.FC<{ timeslotId: number }> = function({ timeslotId }) {
])
);
}
// If we're dragging from a pseudo-column, and a search field is focused, defocus it.
// If we're dragging from a pseudo-column,
// and a search field or library dropdown is focused, defocus it.
if (result.source.droppableId[0] === "$") {
const focus = document.activeElement;
if (focus && focus instanceof HTMLInputElement && focus.type === "text") {
if (
(focus && focus instanceof HTMLInputElement && focus.type === "text") ||
(focus instanceof HTMLSelectElement &&
focus.id === "sidebarLibrarySelect")
) {
focus.blur();
}
}

View file

@ -115,6 +115,7 @@ export function LibraryColumn() {
</div>
<div className="px-2">
<select
id="sidebarLibrarySelect"
className="form-control form-control-sm"
style={{ flex: "none" }}
value={sauce}