GeezerVison is showing github.com — fix: fix bug that prevented modal dialogs from appearing on mobile (#… · scratchfoundation/scratch-blocks@37e0f10
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/data_category.js +10-1Lines changed: 10 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -426,7 +426,16 @@ function addCreateButton(xmlList, workspace, type) { |
426 | 426 | } |
427 | 427 | button.setAttribute("text", msg); |
428 | 428 | button.setAttribute("callbackKey", callbackKey); |
429 | | - workspace.registerButtonCallback(callbackKey, callback); |
| 429 | + workspace.registerButtonCallback(callbackKey, (b) => { |
| 430 | + // Run the callback after a delay to avoid it getting captured by the React |
| 431 | + // modal in scratch-gui and being registered as a click on the scrim that |
| 432 | + // dismisses the dialog. |
| 433 | + requestAnimationFrame(() => { |
| 434 | + setTimeout(() => { |
| 435 | + callback(b); |
| 436 | + }); |
| 437 | + }); |
| 438 | + }); |
430 | 439 | xmlList.push(button); |
431 | 440 | } |
432 | 441 |
|
|
Collapse file
Copy file name to clipboardExpand all lines: src/procedures.js +8-1Lines changed: 8 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -105,7 +105,14 @@ function addCreateButton_(workspace, xmlList) { |
105 | 105 | var msg = Blockly.Msg.NEW_PROCEDURE; |
106 | 106 | var callbackKey = "CREATE_PROCEDURE"; |
107 | 107 | var callback = function () { |
108 | | - createProcedureDefCallback(workspace); |
| 108 | + // Run the callback after a delay to avoid it getting captured by the React |
| 109 | + // modal in scratch-gui and being registered as a click on the scrim that |
| 110 | + // dismisses the dialog. |
| 111 | + requestAnimationFrame(() => { |
| 112 | + setTimeout(() => { |
| 113 | + createProcedureDefCallback(workspace); |
| 114 | + }); |
| 115 | + }); |
109 | 116 | }; |
110 | 117 | button.setAttribute("text", msg); |
111 | 118 | button.setAttribute("callbackKey", callbackKey); |
|