Skip to content

Commit

Permalink
Merge pull request #7265 from surveyjs/bug/file-choose-btn-is-not-cli…
Browse files Browse the repository at this point in the history
…ckable

Fix choose file button is not clickable
  • Loading branch information
OlgaLarina authored Oct 31, 2023
2 parents 909e1ef + 2dcc5b0 commit 9cf130c
Show file tree
Hide file tree
Showing 25 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/react/components/file/file-choose-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class SurveyFileChooseButton extends ReactSurveyElement {
<label
tabIndex={0}
className={this.question.getChooseFileCss()}
// htmlFor={this.question.inputId}
htmlFor={this.question.inputId}
aria-label={this.question.chooseButtonText}
>
{(!!this.question.cssClasses.chooseFileIconId) ? <SvgIcon title={this.question.chooseButtonText} iconName={this.question.cssClasses.chooseFileIconId} size={"auto"}></SvgIcon>: null }
Expand Down
1 change: 0 additions & 1 deletion tests/markup/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ function clearAttributes(el: Element, removeIds = false) {
el.removeAttribute("id");
}
//el.removeAttribute("aria-describedby");
el.removeAttribute("for");
//if(el.getAttribute("list")) el.removeAttribute("list");
el.removeAttribute("fragment");
if(el.getAttribute("style") === "") {
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-2-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Replace file" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-2-zip-png-ro.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-2-zip-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-2-zip.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Replace file" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-2.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" tabindex="0">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-camera.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div>
<label aria-label="Select File" class="sv_q_file_choose_button" tabindex="0">
<label aria-label="Select File" class="sv_q_file_choose_button" for="testid0i" tabindex="0">
<span>Select File</span>
</label>
<span class="sv_q_file_placeholder">No file chosen</span>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-image-size.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div>
<label aria-label="Replace file" class="sv_q_file_choose_button" tabindex="0">
<label aria-label="Replace file" class="sv_q_file_choose_button" for="testid0i" tabindex="0">
<span>Replace file</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-mob2-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Replace file" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-mob2-zip-png-ro.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-mob2-zip-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Select File" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-mob2-zip.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" tabindex="0">
<label aria-label="Replace file" class="sd-context-btn sd-file__choose-btn sd-file__choose-btn--icon" for="testid0i" tabindex="0">
<svg aria-label="Replace file" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-mob2.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" tabindex="0">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-mode-both.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" tabindex="0">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-mode-camera.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="sd-action-bar sd-file__actions-container">
<div class="sv-action sv-action--hidden" id="sv-file-choose-file">
<div class="sv-action__content">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" tabindex="0">
<label aria-label="Select File" class="sd-action sd-file__choose-btn sd-file__choose-btn--text" for="testid0i" tabindex="0">
<svg aria-label="Select File" class="sv-svg-icon" role="img">
<use xlink:href="#icon-choosefile" class="">
</use>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-modern-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div class="sv-file__wrapper">
<label aria-label="Replace file" class="sv-btn sv-file__choose-btn" tabindex="0">
<label aria-label="Replace file" class="sv-btn sv-file__choose-btn" for="testid0i" tabindex="0">
<span>Replace file</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-modern-zip-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div class="sv-file__wrapper">
<label aria-label="Select File" class="sv-btn sv-file__choose-btn" tabindex="0">
<label aria-label="Select File" class="sv-btn sv-file__choose-btn" for="testid0i" tabindex="0">
<span>Select File</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-modern-zip.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div class="sv-file__wrapper">
<label aria-label="Replace file" class="sv-btn sv-file__choose-btn" tabindex="0">
<label aria-label="Replace file" class="sv-btn sv-file__choose-btn" for="testid0i" tabindex="0">
<span>Replace file</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-modern.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div class="sv-file__wrapper">
<label aria-label="Select File" class="sv-btn sv-file__choose-btn" tabindex="0">
<label aria-label="Select File" class="sv-btn sv-file__choose-btn" for="testid0i" tabindex="0">
<span>Select File</span>
</label>
<span class="sv-description sv-file__no-file-chosen">No file chosen</span>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div>
<label aria-label="Replace file" class="sv_q_file_choose_button" tabindex="0">
<label aria-label="Replace file" class="sv_q_file_choose_button" for="testid0i" tabindex="0">
<span>Replace file</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-zip-png.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div>
<label aria-label="Select File" class="sv_q_file_choose_button" tabindex="0">
<label aria-label="Select File" class="sv_q_file_choose_button" for="testid0i" tabindex="0">
<span>Select File</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file-zip.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div>
<label aria-label="Replace file" class="sv_q_file_choose_button" tabindex="0">
<label aria-label="Replace file" class="sv_q_file_choose_button" for="testid0i" tabindex="0">
<span>Replace file</span>
</label>
</div>
Expand Down
2 changes: 1 addition & 1 deletion tests/markup/snapshots/file.snap.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span class="sv-string-viewer">Drag and drop a file here or click the button below to select a file to upload.</span>
</span>
<div>
<label aria-label="Select File" class="sv_q_file_choose_button" tabindex="0">
<label aria-label="Select File" class="sv_q_file_choose_button" for="testid0i" tabindex="0">
<span>Select File</span>
</label>
<span class="sv_q_file_placeholder">No file chosen</span>
Expand Down

0 comments on commit 9cf130c

Please sign in to comment.