Skip to content

Commit 48ef3e0

Browse files
authored
PDOCS-3613: Action verbs rules (#29)
1 parent 80f7c50 commit 48ef3e0

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

styles/PDocs/ActionVerbs.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
extends: substitution
2+
message: "Use '%s' instead of '%s' for clarity and accessibility."
3+
link: https://docs.digitalocean.com/style/digitalocean/language/verbs
4+
ignorecase: true
5+
level: error
6+
action:
7+
name: replace
8+
swap:
9+
# Prefer "enter" over "type" for text input fields and form values
10+
# Based on Microsoft Manual of Style and accessibility best practices
11+
# "Enter" is device-agnostic and works for keyboard, voice, paste, and other input methods
12+
type (?:in|into) the (\w+) (field|box): enter in the $1 $2
13+
type your (\w+) (?:in|into) the (?:\w+ )?(field|box): enter your $1 in the $2
14+
type (?:the|a|an) (\w+) (?:in|into) the (?:\w+ )?(field|box): enter $1 in the $2
15+
type or (?:copy and )?paste: enter
16+
17+
# Prefer "select" over "click" for UI interactions
18+
# "Select" works with keyboard, mouse, touch, voice, and assistive technologies
19+
click the (\*\*[^*]+\*\*) button: select the $1 button
20+
click the (\*\*[^*]+\*\*) link: select the $1 link
21+
click on the (\*\*[^*]+\*\*) button: select the $1 button
22+
click on the (\*\*[^*]+\*\*) link: select the $1 link
23+
click the (\w+(?:\s+\w+)?) button: select the $1 button
24+
click the (\w+(?:\s+\w+)?) link: select the $1 link
25+
click on the (\w+(?:\s+\w+)?) button: select the $1 button
26+
click on the (\w+(?:\s+\w+)?) link: select the $1 link
27+
click the (\w+(?:\s+\w+)?) checkbox: select the $1 checkbox
28+
click on the (\w+(?:\s+\w+)?) checkbox: select the $1 checkbox
29+
click to (\w+): select to $1

styles/PDocs/InputVerbs.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
extends: existence
2+
message: "For accessibility, use 'press' only for keyboard keys. Use 'select' for buttons: '%s'."
3+
link: https://docs.digitalocean.com/style/digitalocean/language/verbs
4+
ignorecase: true
5+
level: error
6+
tokens:
7+
- 'press the \w+ button'
8+
- 'press the button'
9+
- 'press a button'

0 commit comments

Comments
 (0)