mirror of
https://github.com/outline/outline.git
synced 2026-11-26 23:50:14 +03:00
fix: Double tap required in sidebar on iOS (#9665)
* fix: Hover state on mobile sidebar * refactor
This commit is contained in:
1 parent
58d3fad84f
commit
da8fa90e2d
4 files changed
+22
-7
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import { MoreIcon } from "outline-icons";
|
||||
import * as React from "react";
|
||||
import styled from "styled-components";
|
||||
import { extraArea, s } from "@shared/styles";
|
||||
import { extraArea, hover, s } from "@shared/styles";
|
||||
import { isMobile } from "@shared/utils/browser";
|
||||
import Flex from "~/components/Flex";
|
||||
import Text from "~/components/Text";
|
||||
import { draggableOnDesktop, undraggableOnDesktop } from "~/styles";
|
||||
@@ -82,12 +83,12 @@ const Button = styled(Flex)<{
|
||||
flex: 1;
|
||||
color: ${s("textTertiary")};
|
||||
align-items: center;
|
||||
padding: 4px;
|
||||
padding: ${isMobile() ? 12 : 4}px 4px;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
border-radius: 4px;
|
||||
border: 0;
|
||||
margin: ${(props) => (props.$position === "top" ? 16 : 8)}px 0;
|
||||
margin: ${(props) => (!isMobile() && props.$position === "top" ? 16 : 8)}px 0;
|
||||
background: none;
|
||||
flex-shrink: 0;
|
||||
|
||||
@@ -102,7 +103,7 @@ const Button = styled(Flex)<{
|
||||
${extraArea(4)}
|
||||
|
||||
&:active,
|
||||
&:hover,
|
||||
&:${hover},
|
||||
&[aria-expanded="true"] {
|
||||
color: ${s("sidebarText")};
|
||||
background: ${s("sidebarActiveBackground")};
|
||||
|
||||
@@ -4,6 +4,7 @@ import styled, { useTheme, css } from "styled-components";
|
||||
import breakpoint from "styled-components-breakpoint";
|
||||
import EventBoundary from "@shared/components/EventBoundary";
|
||||
import { s } from "@shared/styles";
|
||||
import { isMobile } from "@shared/utils/browser";
|
||||
import NudeButton from "~/components/NudeButton";
|
||||
import { UnreadBadge } from "~/components/UnreadBadge";
|
||||
import useUnmount from "~/hooks/useUnmount";
|
||||
@@ -196,7 +197,7 @@ const Link = styled(NavLink)<{
|
||||
position: relative;
|
||||
text-overflow: ellipsis;
|
||||
font-weight: 475;
|
||||
padding: 6px 16px;
|
||||
padding: ${isMobile() ? 12 : 6}px 16px;
|
||||
border-radius: 4px;
|
||||
min-height: 32px;
|
||||
user-select: none;
|
||||
|
||||
@@ -240,7 +240,7 @@ const FloatingToolbar = React.forwardRef(function FloatingToolbar_(
|
||||
return null;
|
||||
}
|
||||
|
||||
if (props.active) {
|
||||
if (props.active && position.visible) {
|
||||
const rect = document.body.getBoundingClientRect();
|
||||
const safeAreaInsets = getSafeAreaInsets();
|
||||
|
||||
|
||||
+14
-1
@@ -11,7 +11,8 @@ export const isPWA =
|
||||
window.matchMedia?.("(display-mode: standalone)").matches;
|
||||
|
||||
/**
|
||||
* Returns true if the client is a touch device.
|
||||
* Returns true if the client is a touch device. Note that laptops with touch screens are
|
||||
* considered touch devices.
|
||||
*/
|
||||
export function isTouchDevice(): boolean {
|
||||
if (!isBrowser) {
|
||||
@@ -20,6 +21,18 @@ export function isTouchDevice(): boolean {
|
||||
return window.matchMedia?.("(hover: none) and (pointer: coarse)")?.matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the client is a mobile device.
|
||||
*/
|
||||
export function isMobile(): boolean {
|
||||
if (!isBrowser) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Matches breakpoints.tablet - 1 but not imported to avoid circular dependency
|
||||
return window.matchMedia?.(`(max-width: ${736}px)`)?.matches;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the safe area insets for the current device.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user