-
Notifications
You must be signed in to change notification settings - Fork 1
デザインパターンにドラッグ&ドロップのパターンを追加 #1894
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
kesteer
wants to merge
7
commits into
main
Choose a base branch
from
add-rich-interactive-elements-to-design-patterns
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 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b423de6
chore: added rich interactions page
kesteer c143c79
chore: remove scratch pad page
kesteer 5013aea
chore: rewrite the article and restructure
kesteer 4c07395
chore: change directory
kesteer a6df0da
fix: fixed tenses and updated images
kesteer efa8d1f
chore: final fixes before bringing to product design
kesteer 92825cf
Merge branch 'main' of https://github.com/kufu/smarthr-design-system …
kesteer 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
Binary file added
BIN
+75.1 KB
...atterns/rich-interactive-elements/images/smarthr-draggable-list-cancellable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+73.2 KB
...esign-patterns/rich-interactive-elements/images/smarthr-draggable-list-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+78.6 KB
...ign-patterns/rich-interactive-elements/images/smarthr-draggable-list-handle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+71.1 KB
...n-patterns/rich-interactive-elements/images/smarthr-draggable-list-keyboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+63.7 KB
...atterns/rich-interactive-elements/images/smarthr-draggable-list-no-keyboard.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+72.6 KB
...rns/rich-interactive-elements/images/smarthr-draggable-list-non-cancellable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
96 changes: 96 additions & 0 deletions
96
src/content/articles/products/design-patterns/rich-interactive-elements/index.mdx
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,96 @@ | ||
| --- | ||
| title: 'リッチなインタラクション' | ||
| description: 'SmartHRに頻出する、表形式で一覧表示するUIのパターンをまとめています。' | ||
| order: 18 | ||
| --- | ||
| import { Image } from 'astro:assets' | ||
| import DoAndDont from '@/components/article/DoAndDont.astro' | ||
| import { BaseColumn, Cluster, ResponseMessage, Text } from 'smarthr-ui' | ||
| import doUseHandle from './images/smarthr-draggable-list-handle.png' | ||
| import dontUseCard from './images/smarthr-draggable-list-card.png' | ||
| import doCancelAction from './images/smarthr-draggable-list-cancellable.png' | ||
| import dontCancelAction from './images/smarthr-draggable-list-non-cancellable.png' | ||
| import doUseKeyboard from './images/smarthr-draggable-list-keyboard.png' | ||
| import dontUseKeyboard from './images/smarthr-draggable-list-no-keyboard.png' | ||
|
|
||
| SmartHRに頻出する、表形式で一覧表示するUIのパターンをまとめています。 | ||
|
|
||
| リッチなインタラクションが必要なUIには、ユーザーが混乱させないように結束の高いUIが重要になります。 | ||
| ただ、それぞれのUIのパターンにおいて、アクセシビリティを確保することも重要です。 | ||
|
|
||
| この章では、リッチなインタラクションを実装する際のベストプラクティスを紹介します。 | ||
|
|
||
| ## ドラッグ&ドロップ(DnD)リスト | ||
| `ドラグアンドドロップ(DnD)リスト`は、ユーザーがアイテムをドラッグして順序を変更できるUIのパターンです。 | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### キーボードの操作 | ||
| 全部のユーザーがマウスやタッチ入力を使用できるわけではないため、ドラグアンドドロップの操作をキーボードでも可能にすることが重要です。 | ||
|
|
||
| これを実現する一般的な方法は、アイテムを上下に移動するためのボタンを提供することや、拡張された省略メニューのオプションを提供することです。 | ||
|
|
||
| <Cluster gap={1}> | ||
| <DoAndDont type="do" width="calc(50% - 8px)"> | ||
| <Image slot="img" src={doUseKeyboard} alt="Do" /> | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
| <Text slot="label">ドラグアンドドロップの操作をキーボードでも可能にする</Text> | ||
| </DoAndDont> | ||
|
|
||
| <DoAndDont type="dont" width="calc(50% - 8px)"> | ||
| <Image slot="img" src={dontUseKeyboard} alt="Dont" /> | ||
| <Text slot="label">ドラグアンドドロップの操作がマウスやタッチ操作でしかできない</Text> | ||
| </DoAndDont> | ||
| </Cluster> | ||
|
|
||
| ### アクセシビリティの関連情報 | ||
| アクセシブルなドラグアンドドロップの実装には、下記のWCAGのルールを参照してください。 | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
|
|
||
| - [WCAG 2.1.1: キーボードを理解する](https://waic.jp/translations/WCAG22/Understanding/keyboard) | ||
| - [WCAG 2.5.7: ドラッグ動作](https://waic.jp/translations/WCAG22/Understanding/dragging-movements.html) | ||
|
|
||
| ### ドラッグ可能な領域 | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
| <Text weight="bold">ドラッグ可能な領域</Text>とは、ユーザーがリストアイテムをドラッグできる領域のことです。ドラッグ可能な領域は、ユーザーがアイテムをドラッグするための明確なインタラクションポイントを提供する必要があります。 | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
|
|
||
| ドラッグ可能な領域を適切に識別し、ネストされたインタラクティブな要素を避けることが重要です。 | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
| 例えば、ドラッグ可能な領域が`role="button"`を設定されている場合、その中にHTMLのbutton要素をネストされると、`role="button"`がある予想の内部に`<button>`要素が存在することになり、支援技術に混乱を引き起こす恐れがあります。 | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
|
|
||
| その変わりに、ARIA属性を使用して、ドラッグ可能な領域を`draggable=true`として適切に識別し、div要素のままにしておくことができます。また、「ドラッグハンドル」パターンを使用して、インタラクティブなカードコンポーネントとは別のドラッグハンドルを使用できます。 | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
|
|
||
| <Cluster gap={1}> | ||
| <DoAndDont type="do" width="calc(50% - 8px)"> | ||
| <Image slot="img" src={doUseHandle} alt="Do" /> | ||
| <Text slot="label">カード全体的がドラッグ可能より、ハンドラーのみがドラッグ可能</Text> | ||
| </DoAndDont> | ||
|
|
||
| <DoAndDont type="dont" width="calc(50% - 8px)"> | ||
| <Image slot="img" src={dontUseCard} alt="Dont" /> | ||
| <Text slot="label">カードの中にボタン要素が存在するのに、カード全体がドラッグ可能</Text> | ||
| </DoAndDont> | ||
| </Cluster> | ||
|
|
||
| #### アクセシビリティの関連情報 | ||
| アクセシブルなドラグアンドドロップの実装には、下記のWCAGのルールを参照してください。 | ||
|
|
||
| - [WCAG 4.1.2: 名前 (name)・役割 (role)・値 (value)](https://www.w3.org/WAI/WCAG21/Understanding/name-role-value.html) | ||
|
kesteer marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### アクションのキャンセル操作 | ||
|
|
||
| リストアイテムがドラッグ中の状態で、ユーザーはアクションをキャンセルできるようにする必要があります。一般的には、`Escape`キーを使用してキャンセルする方法が実装されます。 | ||
|
|
||
| アクションをキャンセルできない場合は、最新のアクションを元に戻す方法を提供する必要があります。これは、`元に戻す`ボタンやメニューのオプションを通じて行なうことができます。 | ||
|
|
||
| <Cluster gap={1}> | ||
| <DoAndDont type="do" width="calc(50% - 8px)"> | ||
| <Image slot="img" src={doCancelAction} alt="Do" /> | ||
| <Text slot="label">②と③の位置を変えるアクションのあとで、アクションをキャンセルをできるようにする</Text> | ||
| </DoAndDont> | ||
|
|
||
| <DoAndDont type="dont" width="calc(50% - 8px)"> | ||
| <Image slot="img" src={dontCancelAction} alt="Dont" /> | ||
| <Text slot="label">②と③の位置を変えるアクションのあとで、アクションをキャンセルをできないままにする</Text> | ||
| </DoAndDont> | ||
| </Cluster> | ||
|
|
||
| #### アクセシビリティの関連情報 | ||
| アクセシブルなドラグアンドドロップの実装には、下記のWCAGのルールを参照してください。 | ||
|
|
||
| - [WCAG 2.5.2: ポインタのキャンセル](https://waic.jp/translations/WCAG22/Understanding/pointer-cancellation.html) | ||
|
|
||
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.