Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug(tooltip): (reactのみ) tooltipの回り込みが発生したときの、矢印の向きが狂う #1246

Open
ichi-h opened this issue Mar 1, 2024 · 1 comment
Assignees

Comments

@ichi-h
Copy link
Collaborator

ichi-h commented Mar 1, 2024

バグの説明

再現手順・画像・動画

  • tooltipのstoryのtemplateを以下に更新する
const Template: Story = {
  render: (args) => (
    <WizTooltip {...args}>
      <WizText>保険見直し、つみ...</WizText>
    </WizTooltip>
  ),
};
  • Tooltip.Directionのstoryを開く
  • directionに「left」を指定する
  • 回り込みは機能するが、矢印の向きが内側に向かない

image

期待される挙動・機能

  • 回り込みが発生しても、tooltipが適用されている要素の方向に矢印が向く

その他考慮事項(任意)

@ichi-h ichi-h added the 🔽 Low Priority このラベルがついているissueは緊急度が低めです label Mar 12, 2024
@ichi-h ichi-h changed the title Bug(tooltip): 斜め方向の表示に対応する Bug(tooltip): (reactのみ) tooltipの回り込みが発生したときの、矢印の向きが狂う Mar 19, 2024
@ichi-h ichi-h removed the 🔽 Low Priority このラベルがついているissueは緊急度が低めです label Mar 19, 2024
@ichi-h ichi-h assigned okakyo and unassigned RyushiAok Mar 19, 2024
@okakyo
Copy link
Collaborator

okakyo commented Mar 20, 2024

検証について

  • もともとのやつであれば、回り込みは問題なく動作した

    • 実装自体には問題がなく、ブラウザの処理(CSS の block や inline などの機能)が原因と思われる
    • 表示するためにあたっての幅が足りていないことが原因
    • (表示されるTooltip の余白 (margin,padding)) < (tooltip の width) である場合、Tooltip の周り込みが正常に機能しなくなる
  • 仕様上は、Tooltip が左に表示されるところが右側に表示されるため、幅が足りずに右側に回る場合に対しての対応が必要

改善案

  • getBoundingClientRect を利用して、anchor, content のそれぞれの座標位置を割り出して、それぞれの位置関係に応じて アイコンのポジションを変更する

  • 反転条件は、「Tooltip の width, height が表示される箇所の余白よりも大きい場合」

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 開発待ち
Development

No branches or pull requests

3 participants