Skip to content
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

FileUpload: Input Triggered on Any Mouse Click #4948

Closed
balajis-qb opened this issue Sep 24, 2023 · 0 comments · Fixed by qburst/primereact#1, #4949 or qburst/primereact#2
Closed

FileUpload: Input Triggered on Any Mouse Click #4948

balajis-qb opened this issue Sep 24, 2023 · 0 comments · Fixed by qburst/primereact#1, #4949 or qburst/primereact#2
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@balajis-qb
Copy link

balajis-qb commented Sep 24, 2023

Issue Report: FileUpload Input Triggered on Any Mouse Click

Description

The FileUpload component's input is being triggered on any mouse click event, not just the left click. This behavior is unexpected and may lead to unintended file selections.

Steps to Reproduce

Go to https://primereact.org/fileupload/ right click on the first FileUpload (mode="basic") -> see it opens the file browser and closes the context menu directly

Expected Behavior

The expected behavior is that the FileUpload component's input should only be triggered on a left mouse click (e.g., a regular file selection behavior).

Actual Behavior

Only the context menu should open

Reproducer

https://stackblitz.com/edit/stackblitz-starters-qhqcqg?file=src%2FApp.js

Environment Information

  • PrimeReact Version: 9.6.2
  • Browser and Version: Google Chrome 117.0.5938.92 & Brave 1.58.131
  • Operating System: Windows 10 & 11

Code Snippet

import { Toast } from 'primereact/toast';
import { FileUpload } from 'primereact/fileupload';

export default function BasicDemo() {
    const toast = useRef(null);

    const onUpload = () => {
        toast.current.show({ severity: 'info', summary: 'Success', detail: 'File Uploaded' });
    };
        
    return (
        <div className="card flex justify-content-center">
            <Toast ref={toast}></Toast>
            <FileUpload mode="basic" name="demo[]" url="/api/upload" accept="image/*" maxFileSize={1000000} onUpload={onUpload} />
        </div>  
    )
}
@balajis-qb balajis-qb added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 24, 2023
balajis-qb pushed a commit to balajis-qb/primereact that referenced this issue Sep 24, 2023
melloware added a commit to melloware/primereact that referenced this issue Sep 24, 2023
melloware added a commit to melloware/primereact that referenced this issue Sep 24, 2023
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 24, 2023
@melloware melloware self-assigned this Sep 24, 2023
@melloware melloware added this to the 10.0.0 milestone Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment