This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
T/148: getOptimalPosition utility should consider limiter ancestors with CSS overflow. Closes #148. #149
Merged
Merged
T/148: getOptimalPosition utility should consider limiter ancestors with CSS overflow. Closes #148. #149
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
77888f2
Implemented Rect#getVisible method. Defined Rect#_obj property.
oleq ee4b394
Fix: The getOptimalPosition utility should consider limiter ancestors…
oleq c55ea7e
Tests: Refactoring, moved manual FocusTracker tests to a separate dir…
oleq 027d510
Fixed: Range#getVisible throws when used for document#body.
oleq 24e1d14
Performance: Speed up Rect#getVisible nearly twice by avoiding window…
oleq 1123afd
Renamed Rect#_obj to Rect#_source. Code refactoring.
oleq 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
This file contains 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 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 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 |
---|---|---|
|
@@ -159,6 +159,31 @@ describe( 'getOptimalPosition()', () => { | |
name: 'left' | ||
} ); | ||
} ); | ||
|
||
// https://github.com/ckeditor/ckeditor5-utils/issues/148 | ||
it( 'should return coordinates (#3)', () => { | ||
const overflowedAncestor = getElement( { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Webstorm says There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is odd. It's used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This warning is about
vs
but it's a detail. |
||
top: 100, | ||
left: 0, | ||
bottom: 110, | ||
right: 10, | ||
width: 10, | ||
height: 10 | ||
}, { | ||
overflow: 'scroll' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like |
||
} ); | ||
|
||
limiter.parentNode = overflowedAncestor; | ||
|
||
assertPosition( { | ||
element, target, limiter, | ||
positions: [ attachRight, attachLeft ] | ||
}, { | ||
top: 100, | ||
left: 10, | ||
name: 'right' | ||
} ); | ||
} ); | ||
} ); | ||
|
||
describe( 'with fitInViewport on', () => { | ||
|
This file contains 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
File renamed without changes.
This file contains 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
File renamed without changes.
This file contains 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,38 @@ | ||
<div class="wrapper"> | ||
<div class="limiter"> | ||
<div class="target"></div> | ||
</div> | ||
|
||
<div class="source"></div> | ||
</div> | ||
|
||
|
||
<style> | ||
.wrapper { | ||
overflow: scroll; | ||
outline: 1px solid #000; | ||
height: 400px; | ||
position: relative; | ||
padding: 20px; | ||
margin-top: 100px; | ||
} | ||
|
||
.limiter { | ||
height: 500px; | ||
overflow: hidden; | ||
} | ||
|
||
.target { | ||
height: 150px; | ||
background: #ccc; | ||
width: 50px; | ||
margin: 170px auto 0; | ||
} | ||
|
||
.source { | ||
height: 50px; | ||
width: 50px; | ||
background: red; | ||
position: absolute; | ||
} | ||
</style> |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why
defineProperty
?Maybe
_context
instead of_obj
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defineProperty
to setenumerable
false
. Without it iterating over theRect
would also return_obj
and make some pieces of code more complex.As for
_obj
, maybe not_context
because it makes people think aboutthis
and stuff but_from
?