-
Notifications
You must be signed in to change notification settings - Fork 2
feat(layout): enhance hit testing for child nodes in LayoutBox #305
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
Open
EndlessJour9527
wants to merge
8
commits into
main
Choose a base branch
from
feat/enhance_hit_test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
60ab83c
feat(dom): add Overflow HitTest Test HTML fixture for hit-testing ove…
EndlessJour9527 26f2502
feat(layout): refactor child box retrieval and add getChildBoxes() me…
76a3a95
fix(css): correct hover selector for static button by removing unnece…
f4abdf9
restore computed_style
58b768e
fix(layout): optimize getChildBoxes() method by using static_pointer_…
ecb245a
fix
yorkie e94d603
feat(layout): refactor getChildBoxes() method for improved child retr…
61384e7
Merge branch 'feat/enhance_hit_test' of github.com-new:M-CreativeLab/…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
187 changes: 187 additions & 0 deletions
187
fixtures/html/dom/document_hit_testing_on_overflow.html
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Overflow Hit Testing Test</title> | ||
<style> | ||
html, | ||
body { | ||
height: 100%; | ||
margin: 0; | ||
font-family: sans-serif; | ||
} | ||
|
||
.panel { | ||
box-sizing: border-box; | ||
width: 100%; | ||
} | ||
|
||
.top { | ||
height: 50%; | ||
padding: 16px; | ||
background: #fafafa; | ||
border-bottom: 1px solid #ddd; | ||
} | ||
|
||
.bottom { | ||
height: 50%; | ||
padding: 12px 16px; | ||
overflow: auto; | ||
background: #fff; | ||
} | ||
|
||
#container { | ||
position: relative; | ||
/* establish positioning context */ | ||
width: 100%; | ||
height: 60px; | ||
background: #333; | ||
color: #fff; | ||
overflow: visible; | ||
padding: 1rem; | ||
/* explicit */ | ||
outline: 1px dashed #999; | ||
} | ||
|
||
#normalBtn { | ||
margin-bottom: 20px; | ||
padding: 10px 20px; | ||
font-size: 16px; | ||
height: 30px; | ||
background: #28a745; | ||
color: #fff; | ||
border: none; | ||
cursor: pointer; | ||
display: block; | ||
} | ||
|
||
#normalBtn:hover { | ||
background: #218838; | ||
} | ||
|
||
#staticBtn { | ||
position: static; | ||
top: 80px; | ||
background: #8fdaff; | ||
color: #fff; | ||
border: none; | ||
padding: 10px 20px; | ||
cursor: pointer; | ||
display: block; | ||
} | ||
|
||
#staticBtn:hover { | ||
background: #010f17; | ||
} | ||
|
||
.overflow-btn { | ||
/* make top effective */ | ||
position: absolute; | ||
/* intentionally beyond parent height (60px) */ | ||
margin-top: 150px; | ||
background: #007cba; | ||
color: #fff; | ||
border: none; | ||
padding: 10px 20px; | ||
cursor: pointer; | ||
display: block; | ||
} | ||
|
||
.overflow-btn:hover { | ||
background: #005a87; | ||
} | ||
|
||
.test-result { | ||
margin: 6px 0; | ||
padding: 6px 8px; | ||
border: 1px solid #ccc; | ||
font-size: 14px; | ||
} | ||
|
||
.pass { | ||
background: #d4edda; | ||
border-color: #c3e6cb; | ||
color: #155724; | ||
} | ||
|
||
.fail { | ||
background: #f8d7da; | ||
border-color: #f5c6cb; | ||
color: #721c24; | ||
} | ||
|
||
#manual-area { | ||
margin-top: 12px; | ||
padding: 8px; | ||
background: #f7f7f7; | ||
} | ||
|
||
code { | ||
background: #eee; | ||
padding: 2px 4px; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div class="top panel"> | ||
<h1>Overflow HitTest Test</h1> | ||
<p>Goal: verify an overflowed child (overflow:visible on parent) remains hit-testable outside the parent's | ||
visual bounds.</p> | ||
|
||
<button id="normalBtn">Normal Button</button> | ||
<div id="container"> | ||
<p>Container</p> | ||
<button id="staticBtn" class="static-btn">Static Button</button> | ||
<button id="overflowBtn" class="overflow-btn">Overflow Button</button> | ||
</div> | ||
</div> | ||
|
||
<div class="bottom panel"> | ||
<h2>Logs / Results</h2> | ||
<div id="results"></div> | ||
<div id="manual-area"> | ||
<strong>Manual test steps:</strong> | ||
<ol> | ||
<li>Move the pointer onto the "Overflow Button" text (rendered below the parent).</li> | ||
<li>Click it: console should show <code>[CLICK] overflow button</code> and a PASS entry "Manual click | ||
event fired".</li> | ||
<li>If it cannot be clicked, overflow visible hit-testing is broken.</li> | ||
</ol> | ||
</div> | ||
</div> | ||
|
||
<script> | ||
function logResult(message, passed) { | ||
const resultsDiv = document.getElementById('results'); | ||
const div = document.createElement('div'); | ||
div.className = 'test-result ' + (passed ? 'pass' : 'fail'); | ||
div.textContent = (passed ? '✅ PASS: ' : '❌ FAIL: ') + message; | ||
resultsDiv.appendChild(div); | ||
console[(passed ? 'info' : 'warn')](message + ' => ' + (passed ? 'PASS' : 'FAIL')); | ||
} | ||
|
||
// Basic nodes | ||
const container = document.getElementById('container'); | ||
const overflowBtn = document.getElementById('overflowBtn'); | ||
const staticBtn = document.getElementById('staticBtn'); | ||
const normalBtn = document.getElementById('normalBtn'); | ||
|
||
// Programmatic click test (verifies listener, not real hit-testing) | ||
overflowBtn?.addEventListener('click', () => { | ||
console.log('[CLICK] overflow button'); | ||
logResult('Manual click event fired', true); | ||
}); | ||
staticBtn?.addEventListener('click', () => { | ||
console.log('[CLICK] static button'); | ||
logResult('Static button click detected', true); | ||
}); | ||
normalBtn?.addEventListener('click', () => { | ||
console.log('[CLICK] normal button'); | ||
logResult('Normal button click detected', true); | ||
}); | ||
</script> | ||
</body> | ||
|
||
</html> |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.