Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Drag-n-drop on touch screens (#3916)#3941

Merged
kikuomax merged 8 commits intobuefy:devfromkikuomax:touch-dnd
Dec 28, 2023
Merged

Conversation

kikuomax
Copy link
Collaborator

@kikuomaxkikuomax commentedDec 22, 2023
edited
Loading

Fixes

Proposed Changes

  • LetBTable emulate drag-n-drop on touch-enabled devices
    • BTable captures touch events:touchstart,touchmove, andtouchend
    • BTable inserts an extra<div> element to superimpose the dragged contents on the screen, which turns visible only while table rows or columns are being dragged
  • Add how to start dragging rows on touch devices to the documentation page ofBTable

Remarks: users have todouble-tap and hold on a row to start drag-n-drop of the row on touch-enabled devices. Otherwise users cannot do touch-scrolling onBTable.

- Emulates drag&drop events on `BTable` rows on touch-enabled devices.  To start drag&drop of a row, a user has to click (tap) the row first.  This may not be intuitive, though, touch and drag&drop events have  a tradeoff. Since touch events are used to scroll the contents by  default, we cannot interpret them as drag&drop events unless we  prevent the default behavior; i.e., scrolling. However, I felt  trapping scrolling the contents was annoying; scrolling suddenly stops  on a table. So I decided to introduce an extra clicking motion to  start drag&drop.  Code needs refactoring because it is currently redundant.  No visual effect while dragging is implemented yet.issuebuefy#3916
- Moves the code that translates touch events as drag events in `BTable`  to `src/utils/helpers.js` as `translateTouchAsDragEvent`.
- Emulates drag&drop events on `BTable` columns on touch-enabled  devices.  Unlike rows, a user does not have to tap columns before starting  drag&drop columns because I felt columns trapping scrolling less  disturbing.  No visual effect is implemented yet.issuebuefy#3916
- Removes unnecessary code from `BTable`. Removed operations are done by  drag&drop event handlers rather than touch event handlers.
- Fires "dragstart" events at the first "touchmove" events rather than  at "touchstart" events. This will reduce inconsistency that users may  feel when they double-tap columns or rows; columns trigger "drop"  events on themselves when double-tapped, but rows won't trigger "drop"  events. Suppresses "drop" events triggered when users double-tap  columns or rows. Now we may tell users "double-tap and hold columns or  rows if you want to drag&drop them on touch-enabled devices."issuebuefy#3916
- Introduces visual effects shown while rows or columns on `BTable` are  being dragged on touch-enabled devices. The contents of dragged rows  or columns are shown in an extra `div` element appended to `BTable`,  which has `touch-dragged-cell` class and is referenced as  `draggedCell`. `draggedCell` is invisible until rows or columns are  draged on touch-enabled devices. Once touch-dragging starts,  `draggedCell` becomes visible and tracks the point being touched. It  becomes invisible when touch-dragging ends. The content of  `draggedCell` is given via potentially unsafe `v-html`, though, it  should not matter because only valid HTMLs are assigned.  `_table.scss` introduces styles for `touch-dragged-cell` and its  children. It has `background-color` with translucent (10%)  `$table-background-color`.issuebuefy#3916
@netlifyNetlify
Copy link

netlifybot commentedDec 22, 2023
edited
Loading

Deploy Preview forbuefy-org ready!

NameLink
🔨 Latest commit2b2425a
🔍 Latest deploy loghttps://app.netlify.com/sites/buefy-org/deploys/65877b90a0a8b700082f9840
😎 Deploy Previewhttps://deploy-preview-3941--buefy-org.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to yourNetlify site configuration.

@kikuomax
Copy link
CollaboratorAuthor

kikuomax commentedDec 22, 2023
edited
Loading

Anyone can test the behavior here:https://deploy-preview-3941--buefy-org.netlify.app/documentation/table#draggable-rowscolumns (Table - Draggable rows/columns)

@kikuomax
Copy link
CollaboratorAuthor

Anyone can test the behavior here:https://deploy-preview-3941--buefy-org.netlify.app/documentation/table#draggable-rowscolumns (Table - Draggable rows/columns)

I have tested the behavior on

  • iPad Air 5th gen.
  • Pixel 3a (mobile mode)

@kikuomaxkikuomax marked this pull request as ready for reviewDecember 22, 2023 03:08
@wesdevpro
Copy link
Member

wesdevpro commentedDec 22, 2023
edited
Loading

Anyone can test the behavior here:https://deploy-preview-3941--buefy-org.netlify.app/documentation/table#draggable-rowscolumns (Table - Draggable rows/columns)

I have tested the behavior on

  • iPad Air 5th gen.

  • Pixel 3a (mobile mode)

I did some testing on the iPhone 11 Pro with the latest safari update and I've that the drag part of this feature does somewhat work. However, the item is being dragged but does not drop as seen in the pictures below.

kikuomax reacted with thumbs up emoji

- Emulates the visual effects of drag&drop on BTable in the mobile card  mode. Cells must be virtically stacked in the mobile card mode.  Addresses the following comment:    -buefy#3941 (comment)- Also improves the visual effects of drag&drop so that the floating  shapes better imitate the dragged rows.- Corrects indentation in `_table.scss`.
@kikuomax
Copy link
CollaboratorAuthor

I did some testing on the iPhone 11 Pro with the latest safari update and I've that the drag part of this feature does somewhat work. However, the item is being dragged but does not drop as seen in the pictures below.

@wesdevpro Good catch! The floating shapes in the mobile card mode did not resemble what they were displayed in the table (card list) at all. I think the latest commit better imitates the table contents.

wesdevpro reacted with thumbs up emoji

- Adds how to start dragging rows on touch devices to the documentation  page of `BTable`.
@wesdevpro
Copy link
Member

I did some testing on the iPhone 11 Pro with the latest safari update and I've that the drag part of this feature does somewhat work. However, the item is being dragged but does not drop as seen in the pictures below.

@wesdevpro Good catch! The floating shapes in the mobile card mode did not resemble what they were displayed in the table (card list) at all. I think the latest commit better imitates the table contents.

@kikuomax I am still having issues with what is displayed in the list after a drag-and-drop attempt. Was the Netlify link rebuilt from the latest commit on this PR?

@kikuomax
Copy link
CollaboratorAuthor

@kikuomax I am still having issues with what is displayed in the list after a drag-and-drop attempt. Was the Netlify link rebuilt from the latest commit on this PR?

@wesdevpro Could you share what you expect to see?

FYI, the attached video shows what I had expected and saw on the above Netlify preview on iPhone 15 Pro simulator.

DnD.on.iPhone.15.Pro.mp4

@wesdevpro
Copy link
Member

@kikuomax I am still having issues with what is displayed in the list after a drag-and-drop attempt. Was the Netlify link rebuilt from the latest commit on this PR?

@wesdevpro Could you share what you expect to see?

FYI, the attached video shows what I had expected and saw on the above Netlify preview on iPhone 15 Pro simulator.

DnD.on.iPhone.15.Pro.mp4

I was expecting to see the table

t commit better imitates the table contents.

@kikuomax I was expecting the table to update when you let go of the table item. If you look at the date in the item you dragged in the video that item never moves. Was this expected?

@kikuomax
Copy link
CollaboratorAuthor

kikuomax commentedDec 27, 2023
edited
Loading

@kikuomax I was expecting the table to update when you let go of the table item. If you look at the date in the item you dragged in the video that item never moves. Was this expected?

@wesdevpro It was expected. The documentation page ofBTable does not actually change the table items after drag&drop but only pops up a toast message:

drop(payload) {
payload.event.target.closest('tr').classList.remove('is-selected')
constdroppedOnRowIndex=payload.index
this.$buefy.toast.open(`Moved${this.draggingRow.first_name} from row${this.draggingRowIndex+1} to${droppedOnRowIndex+1}`)
},

BTable neither changes the table items with drag&drop. It is "drop" handlers' responsibility. So nothing happens to the table items in the example whether it is running on mobile devices or not.

wesdevpro reacted with thumbs up emoji

@wesdevpro
Copy link
Member

@kikuomax I was expecting the table to update when you let go of the table item. If you look at the date in the item you dragged in the video that item never moves. Was this expected?

@wesdevpro It was expected. The documentation page ofBTable does not actually change the table items after drag&drop but only pops up a toast message:

drop(payload) {
payload.event.target.closest('tr').classList.remove('is-selected')
constdroppedOnRowIndex=payload.index
this.$buefy.toast.open(`Moved${this.draggingRow.first_name} from row${this.draggingRowIndex+1} to${droppedOnRowIndex+1}`)
},

BTable neither changes the table items with drag&drop. It is "drop" handlers' responsibility. So nothing happens to the table items in the example whether it is running on mobile devices or not.

Thank you for the explination.

@kikuomaxkikuomax merged commitd248ca4 intobuefy:devDec 28, 2023
@kikuomaxkikuomax deleted the touch-dnd branchDecember 28, 2023 01:43
kikuomax added a commit to kikuomax/buefy that referenced this pull requestJan 10, 2024
* feat(lib): emulate drag&drop on Table row on touch device- Emulates drag&drop events on `BTable` rows on touch-enabled devices.  To start drag&drop of a row, a user has to click (tap) the row first.  This may not be intuitive, though, touch and drag&drop events have  a tradeoff. Since touch events are used to scroll the contents by  default, we cannot interpret them as drag&drop events unless we  prevent the default behavior; i.e., scrolling. However, I felt  trapping scrolling the contents was annoying; scrolling suddenly stops  on a table. So I decided to introduce an extra clicking motion to  start drag&drop.* feat(lib): emulate drag&drop on Table column on touch device- Emulates drag&drop events on `BTable` columns on touch-enabled  devices.  Unlike rows, a user does not have to tap columns before starting  drag&drop columns because I felt columns trapping scrolling less  disturbing.* feat(lib): fire dragstart at first touchmove (BTable)- Fires "dragstart" events at the first "touchmove" events rather than  at "touchstart" events. This will reduce inconsistency that users may  feel when they double-tap columns or rows; columns trigger "drop"  events on themselves when double-tapped, but rows won't trigger "drop"  events. Suppresses "drop" events triggered when users double-tap  columns or rows. Now we may tell users "double-tap and hold columns or  rows if you want to drag&drop them on touch-enabled devices."* feat(lib): add visual effect of touch-dragging (BTable)- Introduces visual effects shown while rows or columns on `BTable` are  being dragged on touch-enabled devices. The contents of dragged rows  or columns are shown in an extra `div` element appended to `BTable`,  which has `touch-dragged-cell` class and is referenced as  `draggedCell`. `draggedCell` is invisible until rows or columns are  draged on touch-enabled devices. Once touch-dragging starts,  `draggedCell` becomes visible and tracks the point being touched. It  becomes invisible when touch-dragging ends. The content of  `draggedCell` is given via potentially unsafe `v-html`, though, it  should not matter because only valid HTMLs are assigned.  `_table.scss` introduces styles for `touch-dragged-cell` and its  children. It has `background-color` with translucent (10%)  `$table-background-color`.* feat(lib): emulate mobile cards dnd effects (BTable)- Emulates the visual effects of drag&drop on BTable in the mobile card  mode. Cells must be virtically stacked in the mobile card mode.  Addresses the following comment:    -buefy#3941 (comment)- Also improves the visual effects of drag&drop so that the floating  shapes better imitate the dragged rows.* chore(docs): add how to start dragging (BTable)- Adds how to start dragging rows on touch devices to the documentation  page of `BTable`.* test(lib): refresh the snapshot of Table.spec- Merging3c5029b becomes no longer  necessary.* Includes suppression of ESLint warning on `v-html`
kikuomax added a commit to kikuomax/buefy that referenced this pull requestFeb 11, 2024
* feat(lib): emulate drag&drop on Table row on touch device- Emulates drag&drop events on `BTable` rows on touch-enabled devices.  To start drag&drop of a row, a user has to click (tap) the row first.  This may not be intuitive, though, touch and drag&drop events have  a tradeoff. Since touch events are used to scroll the contents by  default, we cannot interpret them as drag&drop events unless we  prevent the default behavior; i.e., scrolling. However, I felt  trapping scrolling the contents was annoying; scrolling suddenly stops  on a table. So I decided to introduce an extra clicking motion to  start drag&drop.* feat(lib): emulate drag&drop on Table column on touch device- Emulates drag&drop events on `BTable` columns on touch-enabled  devices.  Unlike rows, a user does not have to tap columns before starting  drag&drop columns because I felt columns trapping scrolling less  disturbing.* feat(lib): fire dragstart at first touchmove (BTable)- Fires "dragstart" events at the first "touchmove" events rather than  at "touchstart" events. This will reduce inconsistency that users may  feel when they double-tap columns or rows; columns trigger "drop"  events on themselves when double-tapped, but rows won't trigger "drop"  events. Suppresses "drop" events triggered when users double-tap  columns or rows. Now we may tell users "double-tap and hold columns or  rows if you want to drag&drop them on touch-enabled devices."* feat(lib): add visual effect of touch-dragging (BTable)- Introduces visual effects shown while rows or columns on `BTable` are  being dragged on touch-enabled devices. The contents of dragged rows  or columns are shown in an extra `div` element appended to `BTable`,  which has `touch-dragged-cell` class and is referenced as  `draggedCell`. `draggedCell` is invisible until rows or columns are  draged on touch-enabled devices. Once touch-dragging starts,  `draggedCell` becomes visible and tracks the point being touched. It  becomes invisible when touch-dragging ends. The content of  `draggedCell` is given via potentially unsafe `v-html`, though, it  should not matter because only valid HTMLs are assigned.  `_table.scss` introduces styles for `touch-dragged-cell` and its  children. It has `background-color` with translucent (10%)  `$table-background-color`.* feat(lib): emulate mobile cards dnd effects (BTable)- Emulates the visual effects of drag&drop on BTable in the mobile card  mode. Cells must be virtically stacked in the mobile card mode.  Addresses the following comment:    -buefy#3941 (comment)- Also improves the visual effects of drag&drop so that the floating  shapes better imitate the dragged rows.* chore(docs): add how to start dragging (BTable)- Adds how to start dragging rows on touch devices to the documentation  page of `BTable`.* test(lib): refresh the snapshot of Table.spec- Merging3c5029b becomes no longer  necessary.* Includes suppression of ESLint warning on `v-html`
kikuomax added a commit to ntohq/buefy-next that referenced this pull requestFeb 12, 2024
* feat(lib): emulate drag&drop on Table row on touch device- Emulates drag&drop events on `BTable` rows on touch-enabled devices.  To start drag&drop of a row, a user has to click (tap) the row first.  This may not be intuitive, though, touch and drag&drop events have  a tradeoff. Since touch events are used to scroll the contents by  default, we cannot interpret them as drag&drop events unless we  prevent the default behavior; i.e., scrolling. However, I felt  trapping scrolling the contents was annoying; scrolling suddenly stops  on a table. So I decided to introduce an extra clicking motion to  start drag&drop.* feat(lib): emulate drag&drop on Table column on touch device- Emulates drag&drop events on `BTable` columns on touch-enabled  devices.  Unlike rows, a user does not have to tap columns before starting  drag&drop columns because I felt columns trapping scrolling less  disturbing.* feat(lib): fire dragstart at first touchmove (BTable)- Fires "dragstart" events at the first "touchmove" events rather than  at "touchstart" events. This will reduce inconsistency that users may  feel when they double-tap columns or rows; columns trigger "drop"  events on themselves when double-tapped, but rows won't trigger "drop"  events. Suppresses "drop" events triggered when users double-tap  columns or rows. Now we may tell users "double-tap and hold columns or  rows if you want to drag&drop them on touch-enabled devices."* feat(lib): add visual effect of touch-dragging (BTable)- Introduces visual effects shown while rows or columns on `BTable` are  being dragged on touch-enabled devices. The contents of dragged rows  or columns are shown in an extra `div` element appended to `BTable`,  which has `touch-dragged-cell` class and is referenced as  `draggedCell`. `draggedCell` is invisible until rows or columns are  draged on touch-enabled devices. Once touch-dragging starts,  `draggedCell` becomes visible and tracks the point being touched. It  becomes invisible when touch-dragging ends. The content of  `draggedCell` is given via potentially unsafe `v-html`, though, it  should not matter because only valid HTMLs are assigned.  `_table.scss` introduces styles for `touch-dragged-cell` and its  children. It has `background-color` with translucent (10%)  `$table-background-color`.* feat(lib): emulate mobile cards dnd effects (BTable)- Emulates the visual effects of drag&drop on BTable in the mobile card  mode. Cells must be virtically stacked in the mobile card mode.  Addresses the following comment:    -buefy#3941 (comment)- Also improves the visual effects of drag&drop so that the floating  shapes better imitate the dragged rows.* chore(docs): add how to start dragging (BTable)- Adds how to start dragging rows on touch devices to the documentation  page of `BTable`.* test(lib): refresh the snapshot of Table.spec- Merging3c5029b becomes no longer  necessary.* Includes suppression of ESLint warning on `v-html`
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@wesdevprowesdevprowesdevpro approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Does Table draggable drag-n-drop work on touch screens?
2 participants
@kikuomax@wesdevpro

[8]ページ先頭

©2009-2025 Movatter.jp