Skip to content

Replace alert and confirm with custom modals.#13711

Merged
ngxson merged 7 commits into
ggml-org:masterfrom
igardev:webui_use_custom_confirm
May 31, 2025
Merged

Replace alert and confirm with custom modals.#13711
ngxson merged 7 commits into
ggml-org:masterfrom
igardev:webui_use_custom_confirm

Conversation

@igardev

@igardev igardev commented May 22, 2025

Copy link
Copy Markdown
Contributor

Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

@ngxson ngxson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into this, I wanted to do it this way but don't yet have time.

However, just thinking, can we make this a react context provider? I think having a provider which provides a function equivalent to window.confirm/prompt can make it easier to be reused in different places in the code base.

For example, in the code of deleteConversation, we can do something like this:

// somewhere at the beginning of the component
const { showConfirm } = useDialog();

// then, inside the handler
if (await showConfirm()) {
  // delete the conv
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for a11y, this should be an element of type dialog

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@igardev

igardev commented May 22, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for looking into this, I wanted to do it this way but don't yet have time.

However, just thinking, can we make this a react context provider? I think having a provider which provides a function equivalent to window.confirm/prompt can make it easier to be reused in different places in the code base.

For example, in the code of deleteConversation, we can do something like this:

// somewhere at the beginning of the component
const { showConfirm } = useDialog();

// then, inside the handler
if (await showConfirm()) {
  // delete the conv
}

I think I understand what you mean. Will try to do it tomorrow.

@igardev

igardev commented May 23, 2025

Copy link
Copy Markdown
Contributor Author

@ngxson I've changed it to simplify the usage of custom modals.
Just for information - I've noticed that in full screen I don't see the "..." button for the conversations in the sidebar and can't resize the sidebar to show it.

@igardev
igardev force-pushed the webui_use_custom_confirm branch from a07b5d6 to 7eabfe5 Compare May 23, 2025 21:30
@igardev

igardev commented May 26, 2025

Copy link
Copy Markdown
Contributor Author

@ngxson Just a reminder in case you forgot about this code review.

@ngxson ngxson self-assigned this May 26, 2025
@ngxson

ngxson commented May 31, 2025

Copy link
Copy Markdown
Collaborator

Just for information - I've noticed that in full screen I don't see the "..." button for the conversations in the sidebar and can't resize the sidebar to show it.

You have to hover on the conversation and it will show.

If it still doesn't work, please do a screen recording, otherwise it's unclear what happen

@ngxson
ngxson merged commit c7e0a20 into ggml-org:master May 31, 2025
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
phibya pushed a commit to ziee-ai/llama.cpp that referenced this pull request May 29, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
fewtarius pushed a commit to fewtarius/CachyLLama that referenced this pull request May 30, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
* Replace alert and confirm with custom modals. This is needed as Webview in VS Code doesn't permit alert and confirm for security reasons.

* use Modal Provider to simplify the use of confirm and alert modals.

* Increase the z index of the modal dialogs.

* Update index.html.gz

* also add showPrompt

* rebuild

---------

Co-authored-by: igardev <ivailo.gardev@akros.ch>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants