File tree Expand file tree Collapse file tree
src/components/LinkPicker Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -144,18 +144,6 @@ const LinkPickerTitle = ({
144144 </ small >
145145 ) }
146146 </ div >
147- { ( canDelete && ! readonly && ! disabled ) &&
148- // This is a <span> rather than a <Button> because we're inside a <Button> and
149- // trigger an error when you attempt to nest a <Button> inside a <Button>.
150- < span
151- aria-label = { deleteText }
152- role = "button"
153- tabIndex = "0"
154- className = "link-picker__delete btn btn-link"
155- onKeyDown = { handleDeleteKeyDown }
156- onClick = { stopPropagation ( ( ) => ! loading ? onDelete ( id ) : null ) }
157- > { deleteText } </ span >
158- }
159147 </ Button >
160148 { ( isMulti && ! readonly && ! disabled ) && < div className = "link-picker__drag-handle"
161149 { ...attributes }
@@ -170,6 +158,17 @@ const LinkPickerTitle = ({
170158 focusable = "false"
171159 > </ i >
172160 </ div > }
161+ { ( canDelete && ! readonly && ! disabled ) &&
162+ // Intentionally using a regular button element rather than a Button react component
163+ // so that we do not end up with unwanted extra css classes
164+ < button
165+ aria-label = { deleteText }
166+ tabIndex = "0"
167+ className = "link-picker__delete btn btn-link"
168+ onKeyDown = { handleDeleteKeyDown }
169+ onClick = { stopPropagation ( ( ) => ! loading ? onDelete ( id ) : null ) }
170+ > { deleteText } </ button >
171+ }
173172 </ Tag >
174173} ;
175174
Original file line number Diff line number Diff line change @@ -120,7 +120,6 @@ Feature: Accessibility Tests
120120 And I should see "External Link" in the "[data-field-id='Form_EditForm_HasManyLinks'] .link-picker__link--is-last" element
121121 When I press the "Tab" key globally
122122 When I press the "Tab" key globally
123- When I press the "Tab" key globally
124123 Then the active element should be "[data-field-id='Form_EditForm_HasManyLinks'] .link-picker__drag-handle"
125124 Then I press the "Enter" key globally
126125 And I press the "Down" key globally
@@ -132,7 +131,7 @@ Feature: Accessibility Tests
132131
133132 # Test user can delete the link
134133
135- Then I press the "Shift- Tab" key globally
134+ Then I press the "Tab" key globally
136135 Then the active element should be "[data-field-id='Form_EditForm_HasManyLinks'] .link-picker__link:nth-of-type(3) .link-picker__delete"
137136 And I press the "Enter" key and confirm the dialog
138137 And I wait for 3 seconds
You can’t perform that action at this time.
0 commit comments