-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Replacing hideUploadButton param inside SendBox.tsx with disableFileUpload to also hide file upload DropZone as well as button #5508
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
Merged
OEvgeny
merged 25 commits into
microsoft:main
from
JamesNewbyAtMicrosoft:janewby/WebChat
Aug 1, 2025
Merged
Changes from 14 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
239161d
adding hideUploadButton boolean to file upload dropzone and adding to…
JamesNewbyAtMicrosoft 64e5fab
adding space
JamesNewbyAtMicrosoft 9b8d3b3
adding changelog details
JamesNewbyAtMicrosoft 3efb9bc
Merge branch 'main' into janewby/WebChat
JamesNewbyAtMicrosoft 187d415
replacing hideAttachFileButton flag with disableFileUpload
JamesNewbyAtMicrosoft 1c179db
adding for backward compat
JamesNewbyAtMicrosoft 38ad2a0
Merge remote-tracking branch 'origin' into janewby/WebChat
OEvgeny 22fe08c
Bring back old tests
OEvgeny f905b3a
Rework disableFileUpload:
OEvgeny ba66c60
Update packages/api/src/StyleOptions.ts
OEvgeny f5ef7ae
Sort
OEvgeny 88dc42f
added testing for drag and drop, deprecation patch, and removed dual …
JamesNewbyAtMicrosoft c13ee36
Merge branch 'main' into janewby/WebChat
JamesNewbyAtMicrosoft 2d8e366
Merge branch 'main' into janewby/WebChat
JamesNewbyAtMicrosoft 088f92e
commit snapshots
JamesNewbyAtMicrosoft 5c4b931
updated test to comments
JamesNewbyAtMicrosoft 3df7b65
Update CHANGELOG.md
JamesNewbyAtMicrosoft c167376
Improve test and cover false scenario
OEvgeny 48e411b
cleanup
OEvgeny 717cba4
Cleanup
OEvgeny 1c9b1ad
Remove unused test id
OEvgeny e30cc31
fix warning display
OEvgeny dc189ef
Improve message
OEvgeny 2d4adc4
Fix nits
OEvgeny 58ecaea
Changelog
OEvgeny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <title>Disable file upload (copilot)</title> | ||
| <script> | ||
| location = './disableFileUpload?theme=fluent&variant=copilot'; | ||
| </script> | ||
| </head> | ||
| <body></body> | ||
| </html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <!doctype html> | ||
| <html> | ||
| <head> | ||
| <title>Disable file upload (fluent)</title> | ||
| <script> | ||
| location = './disableFileUpload?theme=fluent'; | ||
| </script> | ||
| </head> | ||
| <body></body> | ||
| </html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
|
OEvgeny marked this conversation as resolved.
OEvgeny marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| <!doctype html> | ||
| <html lang="en-US"> | ||
| <head> | ||
| <title>Disable file upload</title> | ||
| <link href="/assets/index.css" rel="stylesheet" type="text/css" /> | ||
| <script crossorigin="anonymous" src="https://unpkg.com/@babel/standalone@7.8.7/babel.min.js"></script> | ||
| <script crossorigin="anonymous" src="https://unpkg.com/react@16.8.6/umd/react.production.min.js"></script> | ||
| <script crossorigin="anonymous" src="https://unpkg.com/react-dom@16.8.6/umd/react-dom.production.min.js"></script> | ||
| <script crossorigin="anonymous" src="/test-harness.js"></script> | ||
| <script crossorigin="anonymous" src="/test-page-object.js"></script> | ||
| <script crossorigin="anonymous" src="/__dist__/webchat-es5.js"></script> | ||
| <script crossorigin="anonymous" src="/__dist__/botframework-webchat-fluent-theme.production.min.js"></script> | ||
| </head> | ||
| <body> | ||
| <main id="webchat"></main> | ||
| <script> | ||
| run(async function () { | ||
| const { directLine, store } = testHelpers.createDirectLineEmulator(); | ||
|
|
||
| WebChat.renderWebChat( | ||
|
JamesNewbyAtMicrosoft marked this conversation as resolved.
Outdated
|
||
| { | ||
| directLine, | ||
| store, | ||
| styleOptions: { disableFileUpload: true } | ||
| }, | ||
| document.getElementById('webchat') | ||
| ); | ||
|
|
||
| await pageConditions.uiConnected(); | ||
|
|
||
| // DOM-based checks | ||
| expect(pageElements.byTestId(WebChat.testIds.sendBoxUploadButton)).toBeFalsy(); | ||
| expect(pageElements.byTestId(WebChat.testIds.sendBoxDropZone)).toBeFalsy(); | ||
|
|
||
| // Keyboard interaction: try to tab to the upload button | ||
| await pageObjects.focusSendBoxTextBox(); | ||
| await host.sendTab(); | ||
| console.log('document.activeElement', document.activeElement); | ||
|
JamesNewbyAtMicrosoft marked this conversation as resolved.
Outdated
|
||
|
|
||
| expect(document.activeElement).not.toBe(pageElements.byTestId(WebChat.testIds.sendBoxUploadButton)); | ||
|
|
||
| // Simulate drag-and-drop using dispatchEvent | ||
| const sendBox = document.querySelector('[role="form"]'); | ||
|
JamesNewbyAtMicrosoft marked this conversation as resolved.
Outdated
|
||
| if (sendBox) { | ||
| const dataTransfer = new DataTransfer(); | ||
| const file = new File(['dummy content'], 'test.txt', { type: 'text/plain' }); | ||
| dataTransfer.items.add(file); | ||
|
|
||
| const dragEnterEvent = new DragEvent('dragenter', { | ||
| bubbles: true, | ||
| cancelable: true, | ||
| dataTransfer | ||
| }); | ||
|
|
||
| const dragOverEvent = new DragEvent('dragover', { | ||
| bubbles: true, | ||
| cancelable: true, | ||
| dataTransfer | ||
| }); | ||
|
|
||
| const dropEvent = new DragEvent('drop', { | ||
| bubbles: true, | ||
| cancelable: true, | ||
| dataTransfer | ||
| }); | ||
|
|
||
| sendBox.dispatchEvent(dragEnterEvent); | ||
| sendBox.dispatchEvent(dragOverEvent); | ||
| sendBox.dispatchEvent(dropEvent); | ||
|
|
||
| // Drop zone should still not appear | ||
| expect(pageElements.byTestId(WebChat.testIds.sendBoxDropZone)).toBeFalsy(); | ||
|
|
||
| // Attachment bar item should not appear | ||
| expect(pageElements.byTestId(WebChat.testIds.sendBoxAttachmentBarItem)).toBeFalsy(); | ||
|
|
||
| await host.snapshot('drag-and-drop-disabled'); | ||
| } | ||
|
JamesNewbyAtMicrosoft marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Hover interaction: hover over the send box area | ||
| await host.hover(document.querySelector('[role="form"]')); | ||
|
JamesNewbyAtMicrosoft marked this conversation as resolved.
Outdated
|
||
| await host.snapshot('hover-over-sendbox-toolbar'); | ||
|
JamesNewbyAtMicrosoft marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Final visual confirmation | ||
| await host.snapshot('local'); | ||
| }); | ||
| </script> | ||
| </body> | ||
| </html> | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
OEvgeny marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.