-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
fix: Handle element in sortable item should be the most recent #493
fix: Handle element in sortable item should be the most recent #493
Conversation
ac82109
to
565685f
Compare
- add problem example to the demo - conditionally rendered sort-handle renders more often than sortable-item - this creates a this.handleElement that is not attached to the document anymore - keyboard drag and drop will not work
- check again for the correct handle element when key down is pressed - this ensures that the this.handleElement is the one that is still in the document body
565685f
to
a980a7a
Compare
- added a test for a conditional rendering of the sort handle - for this test to fail, drag and drop with keyboard has to be done several times - added displaying the fruits only as this is easier to read in the tests
a980a7a
to
96492ee
Compare
Note: I couldn't seem to run
So I fixed the error based on reading the error message. |
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.
Nice!
@@ -268,6 +268,8 @@ export default class SortableItemModifier extends Modifier { | |||
return; | |||
} | |||
|
|||
this.setupHandleElement(); |
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.
This is the main change. If you run the demo and comment out this line, you will see the error I reported in the issue.
Released in 4.0.2 |
Related issue: #492
What changed
{{sort-handle}}
is rendered more often than the{{sortable-item}}
. Because of this, thethis.handleElement
in{{sort-item}}
is one that is no longer in the document body.this.handleElement
in thekeyDown
handler fixes this issueHow to test
(refer to the animation in the issue)
ember serve
ember test
should also pass.