diff --git a/src/material/BottomSheet.css b/src/material/BottomSheet.css index 1d5a937..f65274f 100644 --- a/src/material/BottomSheet.css +++ b/src/material/BottomSheet.css @@ -17,7 +17,10 @@ &::backdrop { - background: none; + background: transparent; + + transition: background-color 120ms var(--tutu-anim-curve-std); + transition-behavior: allow-discrete; } box-shadow: var(--tutu-shadow-e16); @@ -53,7 +56,7 @@ } &.animated { - position: absolute; + position: fixed; overflow: hidden; will-change: width, height, top, left; @@ -66,16 +69,25 @@ top: unset; transform: translateX(-50%); bottom: 0; - content: content; - height: unset; + height: auto; contain: content; contain-intrinsic-size: unset; + &[open]::backdrop { + background: var(--tutu-color-shadow-l1); + } + @media (max-width: 560px) { & { transform: none; - height: unset; + height: auto; } } } -} \ No newline at end of file +} + +@starting-style { + .BottomSheet::backdrop { + background: transparent; + } +} diff --git a/src/material/BottomSheet.tsx b/src/material/BottomSheet.tsx index cd38df7..130a7a2 100644 --- a/src/material/BottomSheet.tsx +++ b/src/material/BottomSheet.tsx @@ -4,6 +4,7 @@ import { createSignal, onCleanup, useTransition, + type JSX, type ParentComponent, type ResolvedChildren, } from "solid-js"; @@ -14,6 +15,7 @@ import material from "./material.module.css"; export type BottomSheetProps = { open?: boolean; bottomUp?: boolean; + class?: JSX.HTMLAttributes["class"]; onClose?(reason: "backdrop"): void; }; @@ -219,10 +221,8 @@ const BottomSheet: ParentComponent = (props) => { return ( void; visibility: TootVisibility; onVisibilityChange: (value: TootVisibility) => void; @@ -76,7 +78,12 @@ const TootVisibilityPickerDialog: Component<{ }; return ( - + void; code: string; onCodeChange: (nval: string) => void; }> = (props) => { return ( - + ( return K[idx]; } +function cancelEvent(event: Event) { + event.stopPropagation(); +} + const TootComposer: Component<{ ref?: Ref; style?: JSX.CSSProperties; @@ -301,7 +313,15 @@ const TootComposer: Component<{ ref={props.ref} class={tootComposers.composer} style={containerStyle()} - onClick={(e) => inputRef.focus()} + onClick={() => { + inputRef.focus(); + }} + on:touchend={ + cancelEvent + /* on: is required to register the event handler on the exact element */ + } + on:touchmove={cancelEvent} + on:wheel={cancelEvent} >
@@ -365,6 +385,7 @@ const TootComposer: Component<{
setPermPicker(false)} visibility={visibility()} @@ -372,6 +393,7 @@ const TootComposer: Component<{ /> setLangPickerOpen(false)} code={language()}