Focus error when calling HtmlDialog with show_modal on mouse click

hello. We’re getting help from the community every time. After SketchUp is updated from version 2022 to version 2023, the function that worked well in 2022 has an error in 2023.
The main content is to execute the function, select an object with the mouse, the information of the selected object is expressed in HtmlDialog, and if the content is modified, the modified content is saved in the object. Immediately after the 2023 version update, UI::Inputbox has resolved the same symptom, but HtmlDialog has not yet been resolved. I wrote a test code and tested it, but I still can’t solve it. Should I wait for the next update?
I also wrote down the code that I tested.

Current SketchUp Version : 23.0.397 64-bit

module Ui_Test
  module ButtonClickUI

    class TestUi
      def initialize
        @ip = nil

      def activate
        @ip =

      def onMouseMove(flags, x, y, view)
        @ip.pick view, x, y

      def onLButtonDown(flags, x, y, view)
        ph = view.pick_helper
        ph.do_pick(x, y)
        entity = ph.best_picked
        if entity.is_a?(Sketchup::Group) then
          html = getHtml()
          dialog ={
            :dialog_title => "Dialog Example",
            :preferences_key => "com.sample.plugin",
            :scrollable => true,
            :resizable => true,
            :width => 600,
            :height => 400,
            :left => 100,
            :top => 100,
            :min_width => 50,
            :min_height => 50,
            :max_width =>1000,
            :max_height => 1000,
            :style => UI::HtmlDialog::STYLE_DIALOG

      def getHtml()
        html = '''
        <!DOCTYPE html>
          <link href="vendor/modus/modus.min.css" rel="stylesheet">
          <body class="m-3 bg-panel-background">
            <form id="dlg-content-area">
              <div class="form-group">
                <label for="scale">Scale</label>
                <input class="form-control" id="scale" placeholder="1:100">
              <div class="form-group">
                <label for="dpi">DPI</label>
                <input class="form-control" id="dpi" placeholder="300">



    tool_menu ="Tools")
    tool_menu.add_item("HtmlUIClickTest") {


1 Like

It has a weird focus bug. The dialog window looks like it has the focus but does not.

We must right-click the model area causing the context-menu to appear,
then click in the dialog to give it actual focus.

I don’t know if there is any way to workaround this as it’s a core GUI bug.

@tt_su @ChrisFullmer ?

I opened an issue in the API tracker and updated the test code a bit.

I also found other issues.

Multiple Issues With `UI::HtmlDialog` (Qt) · Issue #885 · SketchUp/api-issue-tracker · GitHub

Actually, initially the dialog window will not accept any mouse input, but will accept keyboard input.