Skip to content

Commit

Permalink
chore: explicitely define type button on non-submit-button elements
Browse files Browse the repository at this point in the history
Related to #1077
  • Loading branch information
Skaiir committed Mar 4, 2024
1 parent f43adfc commit b79f3c4
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function Palette(props) {
onInput={ handleInput } />
{
searchTerm && (
<button title="Clear content" class="fjs-palette-search-clear" onClick={ handleClear }>
<button type="button" title="Clear content" class="fjs-palette-search-clear" onClick={ handleClear }>
<CloseIcon></CloseIcon>
</button>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export function PaletteEntry(props) {

return (
<button
type="button"
class="fjs-palette-field fjs-drag-copy fjs-no-drop"
data-field-type={ type }
title={ `Create ${getIndefiniteArticle(type)} ${label} element` }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ function Element(props) {
<ContextPad>
{
selection.isSelected(field) && field.type !== 'default'
? <button title={ getRemoveButtonTitle(field, formFields) } class="fjs-context-pad-item" onClick={ onRemove }><DeleteIcon /></button>
? <button type="button" title={ getRemoveButtonTitle(field, formFields) } class="fjs-context-pad-item" onClick={ onRemove }><DeleteIcon /></button>
: null
}
</ContextPad>
Expand Down
2 changes: 1 addition & 1 deletion packages/form-js-playground/src/components/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function Modal(props) {
{ props.children }
</div>
<div class="fjs-pgl-modal-footer">
<button class="fjs-pgl-button fjs-pgl-button-default" onClick={ props.onClose }>Close</button>
<button type="button" class="fjs-pgl-button fjs-pgl-button-default" onClick={ props.onClose }>Close</button>
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/form-js-playground/src/components/PlaygroundRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export function PlaygroundRoot(props) {
{
displayActions && <Section.HeaderItem>
<button
type="button"
class="fjs-pgl-button"
title="Download form definition"
onClick={ handleDownload }
Expand All @@ -283,6 +284,7 @@ export function PlaygroundRoot(props) {
{
displayActions && <Section.HeaderItem>
<button
type="button"
class="fjs-pgl-button"
onClick={ showEmbedModal }
>Embed</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ export class RepeatRenderManager {
}) }
>
{
showAdd ? <button readOnly={ readonly } disabled={ disabled || readonly } class="fjs-repeat-render-add" type="button" ref={ addButtonRef } onClick={ onAddItem }>
showAdd ? <button type="button" readOnly={ readonly } disabled={ disabled || readonly } class="fjs-repeat-render-add" ref={ addButtonRef } onClick={ onAddItem }>
<><AddSvg /> { 'Add new' }</>
</button> : null
}
{
collapseEnabled ? <button class="fjs-repeat-render-collapse" type="button" onClick={ toggle }>
collapseEnabled ? <button type="button" class="fjs-repeat-render-collapse" onClick={ toggle }>
{
isCollapsed
? <><ExpandSvg /> { `Expand all (${values.length})` }</>
Expand Down Expand Up @@ -229,7 +229,7 @@ const RepetitionScaffold = (props) => {
<RowsRenderer { ...elementProps } />
</LocalExpressionContext.Provider>
</div>
<button class="fjs-repeat-row-remove" type="button" aria-label={ `Remove list item ${index + 1}` } onClick={ () => onDeleteItem(index) }>
<button type="button" class="fjs-repeat-row-remove" aria-label={ `Remove list item ${index + 1}` } onClick={ () => onDeleteItem(index) }>
<div class="fjs-repeat-row-remove-icon-container">
<DeleteSvg />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,15 +223,15 @@ export function Numberfield(props) {
<div class={ classNames('fjs-number-arrow-container', { 'fjs-disabled': disabled, 'fjs-readonly': readonly }) }>
{ /* we're disabling tab navigation on both buttons to imitate the native browser behavior of input[type='number'] increment arrows */ }
<button
class="fjs-number-arrow-up"
type="button"
class="fjs-number-arrow-up"
aria-label="Increment"
onClick={ () => increment() }
tabIndex={ -1 }><AngelUpIcon /></button>
<div class="fjs-number-arrow-separator" />
<button
class="fjs-number-arrow-down"
type="button"
class="fjs-number-arrow-down"
aria-label="Decrement"
onClick={ () => decrement() }
tabIndex={ -1 }><AngelDownIcon /></button>
Expand Down

0 comments on commit b79f3c4

Please sign in to comment.