fix: preserve ordinary popover margins by default - #8
Merged
Merged
Conversation
Comment on lines
+621
to
623
| const horizontal = preserveHorizontalAlignment && (side === 'left' || side === 'right' || side === 'start' || side === 'end'); | ||
| let top = !isReplace ? coordTop + (horizontal ? 0 : POPOVER_IOS_BODY_MARGIN) : coordTop - triggerHeight; | ||
| if (horizontal && !isReplace) top = Math.max(bodyPadding, Math.min(top, bodyHeight - bodyPadding - contentHeight)); |
Contributor
There was a problem hiding this comment.
🟡 通常の横配置ポップオーバーが画面外に切れる
横配置でオプションを指定しないと、8px の余白だけが加わり、従来の上下方向のクランプが働きません。画面端付近ではポップオーバーの内容が画面外に出ます。
Learn more
この関数はポップオーバーの座標を画面内に調整します。横配置では従来、bodyPadding を使って上下端を制限していました。今回、余白の有無とクランプの有無を同じ horizontal 条件で切り替えたため、通常の横配置でクランプまで失われます。トリガーが下端付近にあると、コンテンツの下部が見えなくなります。
Example: 画面高 636px、コンテンツ高 52px、coordTop が 620px、side が right、bodyPadding が 5px の場合、デフォルトの top は 628px になります。従来は 579px に制限され、コンテンツ全体が表示されました。
Recommended fix: 横配置かどうかの判定と、余白を省くためのオプトイン判定を分離してください。通常配置には 8px の余白を残しつつ、余白を適用した後の座標も上下の画面内に制限し、オプトイン時の配置も維持してください。
Was this helpful? React with 👍 or 👎 to provide feedback.
| results.referenceCoordinates, | ||
| referenceSizeEl?.getBoundingClientRect(), | ||
| isReplace, | ||
| opts.preserveHorizontalAlignment === true, |
Contributor
npm beta publishedCI passed for the merge commit npm install @rdlabo/ionic-theme-utils@0.1.3-beta.pr8.sha5663c0b4afcd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keep the existing 8px vertical adjustment for ordinary popovers. The enter animation now accepts an explicit preserveHorizontalAlignment option, used by the theme only for projected Vertical Bars controls. Horizontal alignment and viewport clamping are opt-in. Existing tests cover both default margins and opt-in alignment on all four horizontal sides; all 20 tests and the TypeScript build pass.