Bug 39323 - Print dropdown in members toolbar should auto close
Summary: Print dropdown in members toolbar should auto close
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: Owen Leonard
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-13 14:32 UTC by Jason Robb
Modified: 2025-03-26 17:44 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39323: Print dropdown in members toolbar should auto close (9.95 KB, patch)
2025-03-26 16:26 UTC, Owen Leonard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Robb 2025-03-13 14:32:24 UTC
When using the Print dropdown to print something from the patron's account  (summary, slip, etc.) the dropdown no longer closes automatically when clicking an option. This leads to an awkward extra click to clear it away after closing the print dialog.

To replicate -

1 - Pull up a patron
2 - Click Print > Print summary in the toolbar
3 - Close the print dialog
4 - The Print dropdown menu is still open
Comment 1 Jason Robb 2025-03-20 18:08:23 UTC
This is the JS I'm using in the meantime to make the dropdown go away after an item is clicked:

if (window.location.href.indexOf("borrowernumber=") > -1) {
  $('.dropdown-item').on('click', function() {
    $(this).parent().parent().removeClass('show');
  });
}
Comment 2 Carolyn Hughesman 2025-03-25 13:55:37 UTC
We are experiencing this as well.
Comment 3 Owen Leonard 2025-03-26 16:26:47 UTC
Created attachment 179729 [details] [review]
Bug 39323: Print dropdown in members toolbar should auto close

The upgrade to Bootstrap 5 broke some code which was designed to close a
dropdown menu:

$(".btn-group").removeClass("open");

This doesn't work in Bootstrap 5. You have to use:

$(".dropdown-menu").removeClass("show");

However, I found that in most cases this extra code wasn't needed if we
adjust the way we do the click handlers. Using "e.preventDefault()"
instead of "return false" seems to be the preferred practice.

This patch also makes a minor
change to CSS to fix a display issue with dropdown menus.

To test apply the patch and rebuild the staff interface CSS.

- Clear your browser cache if necessary.
- Search the catalog and click "Edit record" on one of the results.
- In the basic MARC editor click the dropdown menu on the "Save" button.
  - Test the three options there: "Save and view record", "Save and edit
    items", and "Save and continue editing".
  - In each case clicking one of those options should result in the menu
    closing before the page redirects.
  - The main "Save" button should still work correctly.

- Perform a patron search which will return results.
  - Check one or more patrons in the result and then click the "Add to
    patron list" button. The dropdown menu should look consistent with
    other dropdowns.

- View the detail page for one of the patron in your results.
  - Test each of the options under the "Print" dropdown menu. In each
    case the menu should close itself when you click one of the menu
    items.
  - Test the "Renew patron" and "Update child to adult patron"
  - Click "Search to hold" and perform a catalog search which will
    return results.
    - Check one or more results and test the "Place hold" dropdown menu
      items.

Sponsored-by: Athens County Public Libraries