forge
Explore
Log in

Don't you dare go Hollow

Three defects the browser found that the compiler could not

Browse files at this commit

7fd5ec2cebf01d678ef766cb16308e3b78e9b88eAhmet Kaan GümüşParent: 9b4b86e
  • fix
    • three defects the browser found that the compiler could not
Show full message
🐛 fix(detail): three defects the browser found that the compiler could not

Driving the modal in a real Firefox turned up three things eighty-four
green tests did not.

Posting a comment closed the modal. `board.refetch()` re-suspends the
board's `Suspense`, which tears down and rebuilds `BoardScreen`, and the
`opened` signal that named the open card was owned by that component —
so it was reborn `None` on every save. It now lives in `Board`, above
the suspense boundary, and is passed down.

Escape did nothing. The keydown handler was bound to the modal element
and relied on `autofocus` to put focus there; Firefox ignores
`autofocus` on an element inserted after the click, so focus stayed on
the card behind the scrim and the modal never heard the key. It is a
`window_event_listener` now, removed on cleanup.

A refused call printed its sentence at the foot of the modal, below the
activity trail — off-screen from the button that was pressed. Each form
renders its own refusal directly beneath itself.

Also from the artboard comparison: the small-caps section labels are
IBM Plex Mono in the design and were rendering in the body face at
weight 600. And two doc comments in the store trait were transposed.

Verified live at 1280x720: screenshots in
~/.cache/vh-runs/20260826-094349-MzMIdQ (comment2, esc2, cycle-inline,
mono-labels). Suites: 15 core unit, 58 store, 11 http, all passing.
crates/dizey-core/src/store/mod.rsmodified+2 -2
@@ -341,12 +341,12 @@ pub trait Store: BoardReads + DetailReads + 'static {
341 at: OffsetDateTime,341 at: OffsetDateTime,
342 ) -> Result<Vec<String>>;342 ) -> Result<Vec<String>>;
343 343
344- /// Appends one line to a task's activity trail. `actor_id` is `None` when
345- /// the system did it rather than a person.
346 /// What a delete would take with it, for the confirmation step. Reads344 /// What a delete would take with it, for the confirmation step. Reads
347 /// only; nothing here writes.345 /// only; nothing here writes.
348 async fn deletion_cost(&self, task_id: &str) -> Result<Option<DeletionCost>>;346 async fn deletion_cost(&self, task_id: &str) -> Result<Option<DeletionCost>>;
349 347
348+ /// Appends one line to a task's activity trail. `actor_id` is `None` when
349+ /// the system did it rather than a person.
350 async fn record_activity(350 async fn record_activity(
351 &self,351 &self,
352 task_id: &str,352 task_id: &str,
crates/dizey-web/src/board.rsmodified+13 -3
@@ -120,6 +120,11 @@ impl Filter {
120 #[component]120 #[component]
121 pub fn Board() -> impl IntoView {121 pub fn Board() -> impl IntoView {
122 let board = Resource::new(|| (), |_| async move { current_board().await });122 let board = Resource::new(|| (), |_| async move { current_board().await });
123+ // Which card is open in the detail modal, if any. It lives out here, above
124+ // the suspense boundary: a refetch rebuilds `BoardScreen` from scratch, and
125+ // a signal owned by that component would be born empty again — closing the
126+ // modal every time something inside it saved.
127+ let opened = RwSignal::new(None::<String>);
123 128
124 view! {129 view! {
125 <Suspense fallback=|| {130 <Suspense fallback=|| {
@@ -128,7 +133,13 @@ pub fn Board() -> impl IntoView {
128 {move || Suspend::new(async move {133 {move || Suspend::new(async move {
129 match board.await {134 match board.await {
130 Ok(Ok(snapshot)) => {135 Ok(Ok(snapshot)) => {
131- view! { <BoardScreen snapshot=snapshot on_change=move || board.refetch()/> }136+ view! {
137+ <BoardScreen
138+ snapshot=snapshot
139+ opened=opened
140+ on_change=move || board.refetch()
141+ />
142+ }
132 .into_any()143 .into_any()
133 }144 }
134 Ok(Err(refusal)) => {145 Ok(Err(refusal)) => {
@@ -156,14 +167,13 @@ pub fn Board() -> impl IntoView {
156 #[component]167 #[component]
157 fn BoardScreen(168 fn BoardScreen(
158 snapshot: BoardSnapshot,169 snapshot: BoardSnapshot,
170+ opened: RwSignal<Option<String>>,
159 on_change: impl Fn() + Copy + Send + Sync + 'static,171 on_change: impl Fn() + Copy + Send + Sync + 'static,
160 ) -> impl IntoView {172 ) -> impl IntoView {
161 let BoardSnapshot { view, me, today } = snapshot;173 let BoardSnapshot { view, me, today } = snapshot;
162 let filter = RwSignal::new(Filter::All);174 let filter = RwSignal::new(Filter::All);
163 // Which column has its composer open, if any.175 // Which column has its composer open, if any.
164 let composing = RwSignal::new(None::<String>);176 let composing = RwSignal::new(None::<String>);
165- // Which card is open in the detail modal, if any.
166- let opened = RwSignal::new(None::<String>);
167 let may_write = me.role.can_write_tasks();177 let may_write = me.role.can_write_tasks();
168 let my_id = StoredValue::new(me.id.clone());178 let my_id = StoredValue::new(me.id.clone());
169 179
crates/dizey-web/src/detail.rsmodified+42 -28
@@ -432,6 +432,29 @@ pub async fn delete_task(task_id: String) -> Result<Option<Refusal>, ServerFnErr
432 432
433 // -- the screen -------------------------------------------------------------433 // -- the screen -------------------------------------------------------------
434 434
435+/// Whatever a refused call said, rendered where the form that asked for it is.
436+/// A refusal shown at the far end of a scrolling modal is a refusal nobody
437+/// reads: the person clicked "Link a task" and the sentence has to land under
438+/// that button, not under the activity trail.
439+fn refused<S>(action: ServerAction<S>) -> impl IntoView
440+where
441+ S: leptos::server_fn::ServerFn<Output = Option<Refusal>> + Send + Sync + Clone + 'static,
442+ S::Error: Clone + Send + Sync + 'static,
443+{
444+ move || {
445+ action
446+ .value()
447+ .get()
448+ .and_then(|answer| match answer {
449+ Ok(refusal) => refusal,
450+ // The call never arrived, which is not the person's mistake and
451+ // is not a sentence about their task.
452+ Err(_) => Some(Refusal::Unavailable),
453+ })
454+ .map(|refusal| view! { <p class="modal-problem">{refusal.message()}</p> })
455+ }
456+}
457+
435 /// The modal. `esc` closes it, as the artboard's chip says.458 /// The modal. `esc` closes it, as the artboard's chip says.
436 #[component]459 #[component]
437 pub fn TaskDetailModal(460 pub fn TaskDetailModal(
@@ -451,27 +474,22 @@ pub fn TaskDetailModal(
451 on_change();474 on_change();
452 };475 };
453 476
454- view! {477+ // Escape listens on the window, not on the modal. The modal is inserted
455- <div478+ // after the click that opened it, so focus is still on the card behind the
456- class="modal-scrim"479+ // scrim and a listener bound to this element would never hear the key.
457- on:click=move |_| on_close()480+ #[cfg(feature = "hydrate")]
458- on:keydown=move |event| {481+ {
459- if event.key() == "Escape" {482+ let handle = window_event_listener(leptos::ev::keydown, move |event| {
460- on_close();483+ if event.key() == "Escape" {
461- }484+ on_close();
462 }485 }
463- >486+ });
464- <div487+ on_cleanup(move || handle.remove());
465- class="modal"488+ }
466- tabindex="-1"489+
467- autofocus490+ view! {
468- on:click=move |event| event.stop_propagation()491+ <div class="modal-scrim" on:click=move |_| on_close()>
469- on:keydown=move |event| {492+ <div class="modal" tabindex="-1" on:click=move |event| event.stop_propagation()>
470- if event.key() == "Escape" {
471- on_close();
472- }
473- }
474- >
475 <Suspense fallback=|| {493 <Suspense fallback=|| {
476 view! { <div class="modal-loading"></div> }494 view! { <div class="modal-loading"></div> }
477 }>495 }>
@@ -557,13 +575,6 @@ fn DetailScreen(
557 }575 }
558 });576 });
559 577
560- let problem = move || {
561- [save.value(), comment.value(), link.value(), remove.value()]
562- .into_iter()
563- .find_map(|value| value.get().and_then(|answer| answer.ok().flatten()))
564- .map(|refusal| view! { <p class="modal-problem">{refusal.message()}</p> })
565- };
566-
567 view! {578 view! {
568 <header class="detail-head">579 <header class="detail-head">
569 <span class="detail-key">{task_key}</span>580 <span class="detail-key">{task_key}</span>
@@ -656,6 +667,7 @@ fn DetailScreen(
656 "Save"667 "Save"
657 </button>668 </button>
658 </div>669 </div>
670+ {refused(save)}
659 }671 }
660 })}672 })}
661 </ActionForm>673 </ActionForm>
@@ -735,6 +747,7 @@ fn DetailScreen(
735 "Link a task"747 "Link a task"
736 </button>748 </button>
737 </ActionForm>749 </ActionForm>
750+ {refused(link)}
738 }751 }
739 })}752 })}
740 </section>753 </section>
@@ -770,6 +783,7 @@ fn DetailScreen(
770 </button>783 </button>
771 </div>784 </div>
772 </ActionForm>785 </ActionForm>
786+ {refused(comment)}
773 }787 }
774 })}788 })}
775 </section>789 </section>
@@ -796,7 +810,7 @@ fn DetailScreen(
796 .collect_view()}810 .collect_view()}
797 </section>811 </section>
798 812
799- {problem}813+ {refused(remove)}
800 814
801 {move || {815 {move || {
802 ask.value()816 ask.value()
style/main.scssmodified+3 -3
@@ -712,8 +712,8 @@ a {
712 }712 }
713 713
714 .detail-label {714 .detail-label {
715+ font-family: var(--font-mono);
715 font-size: 10px;716 font-size: 10px;
716- font-weight: 600;
717 letter-spacing: 0.08em;717 letter-spacing: 0.08em;
718 color: var(--muted-soft);718 color: var(--muted-soft);
719 }719 }
@@ -852,9 +852,9 @@ a {
852 }852 }
853 853
854 .dep-heading {854 .dep-heading {
855+ font-family: var(--font-mono);
855 font-size: 10px;856 font-size: 10px;
856- font-weight: 600;857+ letter-spacing: 0.06em;
857- letter-spacing: 0.08em;
858 color: var(--muted-soft);858 color: var(--muted-soft);
859 }859 }
860 860