Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Reach the overview rows from the keyboard, and let Escape on the "+" modal spare the lane

Guido Boyke984e5f808549
diff --git a/app/javascript/controllers/layout_toggle_controller.js b/app/javascript/controllers/layout_toggle_controller.js
index 00dc952..9c7c015 100644
--- a/app/javascript/controllers/layout_toggle_controller.js
+++ b/app/javascript/controllers/layout_toggle_controller.js
@@ -167,7 +167,10 @@ export default class extends Controller {
'[data-select-layer]:not([hidden])',
'[data-ticket-bulk-panel-target="pickerMenu"]:not([hidden])',
// The "Link" modal is the content of its frame: present only while open.
- '[data-controller~="ticket-relation-modal"]'
+ '[data-controller~="ticket-relation-modal"]',
+ // The "+" modal of "Alle Meetings" hides with the class and listens on
+ // window, after this document listener.
+ '[data-meeting-modal-target="modal"]:not(.hidden)'
].join(', ')))
}
diff --git a/app/views/organisations/meetings_overview/_list_head.html.erb b/app/views/organisations/meetings_overview/_list_head.html.erb
index 937ba3d..c4b44d7 100644
--- a/app/views/organisations/meetings_overview/_list_head.html.erb
+++ b/app/views/organisations/meetings_overview/_list_head.html.erb
@@ -31,7 +31,9 @@
the same sentence. Only the category "Projekt" is this page's own.
Unlike the project page, the bar stands before the first meeting too: the
"+" modal replaces only the list frame, never this head, so a bar left out
- here would stay missing until a full reload. %>
+ here would stay missing until a full reload.
+ keyboard_navigation: the rows hold no link of their own (they open in the
+ lane), so arrow down from the search field is the keyboard's way in. %>
<%= render NeoFilterBarComponent.new(
current_user_id: current_user.id,
smart_folders: @meeting_smart_folders,
@@ -55,6 +57,7 @@
search_value: params[:search],
search_mode: @current_search_mode,
search_modes: %w[title_only content],
+ keyboard_navigation: true,
organisation: @current_organisation
) do |bar| %>
<%# The column picker, at the place the project page has it. %>
diff --git a/spec/javascript/controllers/layout_toggle_controller.test.js b/spec/javascript/controllers/layout_toggle_controller.test.js
index bce6fdc..edf4054 100644
--- a/spec/javascript/controllers/layout_toggle_controller.test.js
+++ b/spec/javascript/controllers/layout_toggle_controller.test.js
@@ -37,7 +37,10 @@ test('an open dialog or menu owns Escape before the detail lane', () => {
'[data-ticket-bulk-panel-target="pickerMenu"]:not([hidden])',
// The "Link" modal of a ticket page is the content of its frame, so it
// exists only while open. Without it Escape closed the lane BEHIND it.
- '[data-controller~="ticket-relation-modal"]'
+ '[data-controller~="ticket-relation-modal"]',
+ // The "+" modal of "Alle Meetings": Escape closed it AND the lane behind
+ // it, with an unsaved edit in that lane.
+ '[data-meeting-modal-target="modal"]:not(.hidden)'
]
for (const overlay of overlays) {
diff --git a/spec/system/meetings_overview_spec.rb b/spec/system/meetings_overview_spec.rb
index d58ad66..db2de34 100644
--- a/spec/system/meetings_overview_spec.rb
+++ b/spec/system/meetings_overview_spec.rb
@@ -276,20 +276,48 @@ RSpec.describe 'Meetings overview', type: :system do
expect(page).to have_no_css('.labor-layout-view.show-content')
end
- it 'opens a row from the keyboard' do
+ it 'enters the rows from the search field and opens a meeting with the keyboard' do
+ page.driver.browser.manage.window.resize_to(1440, 1000)
+ # A search value keeps the field open, as in the project page's spec.
+ visit organisation_meetings_path(organisation, search: 'a', search_mode: 'title_only')
+ expect(page).to have_css(overview_rows, count: 3, wait: 10)
+
+ # No click first: the rows hold no link of their own (tabindex -1), so
+ # the search field is the one way in, as on the project page.
+ # The scripts load after the rows show: an arrow pressed before the
+ # keyboard controller listens does nothing, so it is pressed again.
+ search = find('input[name="search"]')
+ page.document.synchronize(5) do
+ search.send_keys(:arrow_down)
+ raise Capybara::ElementNotFound, 'no row has focus yet' unless page.has_css?("#{overview_rows}:focus", wait: 0.2)
+ end
+ row = find("#{overview_rows}:focus")
+ expect(row).to eq(first(overview_rows))
+ row.send_keys(:arrow_down)
+ row = find("#{overview_rows}:focus")
+ expect(row).to have_text('Alpha Kickoff')
+ row.send_keys(:enter)
+ expect(page).to have_css('#meeting_display_frame h2', text: 'Alpha Kickoff', wait: 5)
+ expect(page).to have_css("#{overview_rows}.selected-row", text: 'Alpha Kickoff')
+ end
+
+ it 'leaves the open lane and its unsaved edit alone when Escape closes the "+" modal' do
page.driver.browser.manage.window.resize_to(1440, 1000)
visit organisation_meetings_path(organisation)
expect_titles('Alpha Kickoff', 'Beta Retro', 'Alpha Ohne Anna')
-
- # A click opens and focuses the first row. The first arrow lands on the
- # first row (as on the project page), the second on the next; Enter opens.
row_of('Beta Retro').click
- expect(page).to have_css('#meeting_display_frame h2', text: 'Beta Retro', wait: 5)
- page.send_keys(:arrow_down)
- page.send_keys(:arrow_down)
- page.send_keys(:enter)
- expect(page).to have_css('#meeting_display_frame h2', text: 'Alpha Kickoff', wait: 5)
- expect(page).to have_css("#{overview_rows}.selected-row", text: 'Alpha Kickoff')
+ expect(lane_title).to have_text('Beta Retro')
+ within('#meeting_display_frame') { find("a[title='#{I18n.t('views.organisations.meetings.show.edit_meeting')}']", match: :first).click }
+ within('#meeting_display_frame') { fill_in 'meeting[title]', with: 'Ungespeichert' }
+
+ find("button[title='#{I18n.t('views.organisations.meetings_overview.index.new_meeting')}']").click
+ expect(page).to have_css('[data-meeting-modal-target="modal"]:not(.hidden)', wait: 5)
+ page.send_keys(:escape)
+
+ expect(page).to have_no_css('[data-meeting-modal-target="modal"]:not(.hidden)', wait: 5)
+ expect(page).to have_css('.labor-layout-view.show-content')
+ expect(find('#meeting_display_frame').find_field('meeting[title]').value).to eq('Ungespeichert')
+ expect(page).to have_current_path(/meeting_id=#{meeting('Beta Retro').id}/)
end
it 'opens the meeting full width on a phone and leads back to the list with its search' do