Skip to content

fix: ドラッグの終了判定を緩和する#4998

Merged
uni-kakurenbo merged 1 commit into
masterfrom
fix/relax-drag-end-detection
Dec 30, 2025
Merged

fix: ドラッグの終了判定を緩和する#4998
uni-kakurenbo merged 1 commit into
masterfrom
fix/relax-drag-end-detection

Conversation

@uni-kakurenbo

@uni-kakurenbo uni-kakurenbo commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

概要

  • ドラッグ中,pointerup が発火する前にキーボード操作等でフォーカスが切り替わるとドラッグの継続判定が残り続ける不具合があったのを修正.
    • 以下の場合にもドラッグが終了したと判定する:
      • Escape キーが押下されたとき
      • pointercancel イベントが発火したとき
      • documentcontextmenu イベントが発火したとき
      • documentchangevisivility イベントが発火し, hidden となったとき
      • windowblur イベントが発火したとき
  • optimize: VueUse を用いてグローバルなイベント監視を効率化する #4890 に依存しています

なぜこの PR を入れたいのか

PR を出す前の確認事項

  • 動作確認ができている
  • 自分で一度コードを眺めて自分的に問題はなさそう

@uni-kakurenbo uni-kakurenbo self-assigned this Dec 29, 2025
@uni-kakurenbo uni-kakurenbo added the bug Something isn't working label Dec 29, 2025
@github-actions

Copy link
Copy Markdown

@uni-kakurenbo uni-kakurenbo requested review from a team, cp-20 and yas-ako December 29, 2025 10:47
@cp-20

cp-20 commented Dec 29, 2025

Copy link
Copy Markdown
Member

diff がデカくて見づらいので #4890 の後に見ます

@cp-20 cp-20 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ありがとう

概ね良いと思いますが、1つだけコメントしたので直してもらえると嬉しいです

Comment thread src/composables/dom/useDragging.ts Outdated

isDragging.value = true

document.body.style.cursor = 'e-resize'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このスタイルは useNavigationResizer に特化したものなので、ここにあると良くなさそう

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

あっ、なおしました

@uni-kakurenbo uni-kakurenbo force-pushed the fix/relax-drag-end-detection branch from 22ccefb to b998d3e Compare December 30, 2025 06:32
@codecov

codecov Bot commented Dec 30, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.81%. Comparing base (57d6ef2) to head (05dc12c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4998   +/-   ##
=======================================
  Coverage   60.81%   60.81%           
=======================================
  Files         101      101           
  Lines        2973     2973           
  Branches      616      616           
=======================================
  Hits         1808     1808           
  Misses       1071     1071           
  Partials       94       94           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@uni-kakurenbo uni-kakurenbo force-pushed the fix/relax-drag-end-detection branch 3 times, most recently from 212b144 to 32a9329 Compare December 30, 2025 06:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where drag operations would not properly terminate when focus changed during dragging (e.g., via keyboard shortcuts). The fix introduces a new reusable useDragging composable that handles multiple drag termination conditions beyond the standard pointerup event.

  • Introduced useDragging composable to centralize drag handling logic with enhanced termination conditions
  • Refactored useNavigationResizer to use the new composable, reducing code duplication
  • Added pointercancel event handler to the resizer element for better drag state management

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/composables/dom/useDragging.ts New composable that manages drag state and handles termination via Escape key, pointercancel, contextmenu, visibilitychange, blur, and pagehide events
src/components/Main/NavigationBar/composables/useNavigationResizer.ts Refactored to use useDragging composable, simplifying code and removing duplicate drag handling logic
src/components/Main/NavigationBar/DesktopNavigationBar.vue Added @pointercancel event listener to handle pointer cancellation events

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/composables/dom/useDragging.ts Outdated
Comment thread src/composables/dom/useDragging.ts
@uni-kakurenbo uni-kakurenbo force-pushed the fix/relax-drag-end-detection branch from 32a9329 to 05dc12c Compare December 30, 2025 07:16

@cp-20 cp-20 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@uni-kakurenbo uni-kakurenbo merged commit d885848 into master Dec 30, 2025
11 checks passed
@uni-kakurenbo uni-kakurenbo deleted the fix/relax-drag-end-detection branch December 30, 2025 15:25
@github-project-automation github-project-automation Bot moved this from Inbox to Done in traQ Client Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants