Skip to content

Commit

Permalink
fix: added missing prevent ios mobile zoom trick (#361)
Browse files Browse the repository at this point in the history
## Changes
- Fixed that prevent zoom when focusing on input in iOS mobile

ticket: []

## Additional Notes
- 

## Checklist
Before requesting a code review, please check the following:
- [x] **[Required]** CI has passed all checks.
- [x] **[Required]** A self-review has been conducted to ensure there
are no minor mistakes.
- [x] **[Required]** Unnecessary comments/debugging code have been
removed.
- [x] **[Required]** All requirements specified in the ticket have been
accurately implemented.
- [ ] Ensure the ticket has been updated with the sprint, status, and
story points.
  • Loading branch information
bang9 authored Sep 12, 2024
1 parent 3a673ea commit 83e3560
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/components/chat/ui/ChatInput.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { css } from '@linaria/core';
import { css, cx } from '@linaria/core';
import { useRef, useState } from 'react';

import useSendbirdStateContext from '@uikit/hooks/useSendbirdStateContext';
Expand All @@ -24,7 +24,7 @@ export const ChatInput = () => {
});

return (
<div className={container}>
<div className={cx(container, isIOSMobile && iosMobileContainer)}>
<MessageInputWrapperView
loading={false}
disabled={config.isOnline ? isMessageInputDisabled : true}
Expand Down Expand Up @@ -52,6 +52,25 @@ export const ChatInput = () => {
);
};

// Not to zoom in on mobile set font-size to 16px which blocks the zooming on iOS
// @link: https://weblog.west-wind.com/posts/2023/Apr/17/Preventing-iOS-Safari-Textbox-Zooming
const iosMobileContainer = css`
&&&& {
.sendbird-message-input-text-field {
min-height: 40px;
height: 40px;
font-size: 16px;
line-height: 24px;
}
.sendbird-message-input--placeholder {
font-size: 16px;
}
.sendbird-message-input--attach {
inset-block-end: 4px;
}
}
`;

const container = css`
z-index: 0;
border: none;
Expand Down Expand Up @@ -82,9 +101,6 @@ const container = css`
padding-bottom: 8px;
padding-inline-start: 16px;
border-radius: 20px;
// Not to zoom in on mobile set font-size to 16px which blocks the zooming on iOS
// @link: https://weblog.west-wind.com/posts/2023/Apr/17/Preventing-iOS-Safari-Textbox-Zooming
font-size: ${isIOSMobile ? 16 : 14}px;
resize: none;
border: none;
outline: none;
Expand Down

0 comments on commit 83e3560

Please sign in to comment.