Bug – Alt Key Not Releasing The Menu Bar Focus

Developing another script I stumbled upon an issue that I had not previously noticed regarding Undo.

The following script has severed me well since SketchUp 2021:

module PMC
	module AssignToTag

		extend self

		MENU ||= "Extensions"

		def assign_to_tag(assigned_tag)

			model = Sketchup.active_model		
			model.start_operation("Assigned to Tag: #{assigned_tag.name}")
			model.selection.each { |t|
				t.layer = assigned_tag if t.layer!=assigned_tag


		if !defined?(@ui_loaded)

			menu = UI.menu(MENU).add_submenu("Assign to Tag")

			Sketchup.active_model.layers.sort.each { |tag|
				tagname = tag.name
					if tagname == "Layer0"
						tagname = "Untagged"
				menu.add_item(tagname) { assign_to_tag(tag) }

			@ui_loaded = true


( the extension is specific to me and not meant for release as it has limitations )

I assign keyboard shortcuts to some of the Assign Tag commands.

On start-up, in 2023 ctrl z does not work unless I have clicked anywhere in the modelling space, or orbited or panned. After I have done this, ctrl z works as expected whenever I have assigned a tag via my extension.

Curiously, if instead of doing ctrl z I go to Edit>Undo…, Undo works as expected.

In 2022 I can invoke the keyboard Assign Tag shortcut and then perform a ctrl z and the tag assignment is undone – every time including for the first time after start-up.

I have done a Repair as administrator and the problem persists.

Curiously again, in 2023 Alt+Backspace is also set as a shortcut for Undo as well as ctrl z but I can’t delete it – whereas in 2022 I can delete Alt+Backspace.

From Google:
Is Alt Backspace is used for undo?

In most Microsoft Windows applications, the keyboard shortcut for the undo command is Ctrl+Z or Alt+Backspace, and the shortcut for redo is Ctrl+Y or Ctrl+Shift+Z.

Is the alt+backspace hard wired?

This is weird.

In 2023, on start-up, if I do Alt+Backspace as Undo for the very first time an Undo occurs but not with ctrl z.

How do you mean?

If I assign a tag using Entity Info there is no problem at all using ctrl z in 2023

I wonder if this is somehow caused by the rework of the GUI on SketchUp for Windows to use Qt for 2023?

After a number of repairs I decided to uninstall and re-install ( deleting SharedPreferences.json files in all my Roaming SketchUp folders so that the new install wouldn’t import previous shortcuts ).

Problem persists in 2023 and Alt+Backspace cannot be deleted like in 2022 ( even though it &%*@$ $%-ing comes back after restart ).

Well, it’s trusty AutoHotkey to the rescue - assign ctrl z ( actually z ) to Alt+Backspace.

Could be the new Qt framework…?

It is not listed in the windows shortcuts, I did a fairly deep dive.

Deleting all files in the Roaming folder is a very drastic step that should not be done, until getting feedback from Trimble. Ie, … shortcuts are not caused by extensions because the API only allows listing them. There is no API exposure to set them as they are considered a user private function.

To reset user shortcuts, 1st export them to a file.
Close SketchUp.
Then edit (delete) the "SharedPreferences.json" shortcuts in the ""Windows Only/Settings" object. Make sure to set the "Num_Shortcuts" to the correct number (likely 0.)
Then resave the json file.

Because it is hard coded. Many of the “application level” shortcuts have always been hard-coded and do not appear in the user shortcuts in the JSON files nor in the registry in older versions.

I filed a “complaint” about not being able to change the CTRL+SHIFT+I shortcut as we could prior to 2023. (I use it to bring up the Chrome Developer Tools.)
In 2023 it is hard-coded to Edit > Invert Selection and cannot be changed.

Brad noted that for some of these shortcuts, they previously (pre-2023) could be changed per session, but reverted back when SketchUp was restarted.

Colin proposed that the shortcuts using CTRL are “system shortcuts” and cannot be permanently changed.

I have evidence that such shortcuts can be changed. In Windows Notepad++ we can can change any shortcut we wish. Even CTRL+O, CTRL+S. (I just did it because I don’t use these shortcuts for opening or saving files. I instead often need to open the folder in Explorer where the code file is, so I changed the shortcut for Open to CTRL+ALT+O and used CTRL+O for Open Folder in Explorer.)

I think perhaps so. Something might have changed when converting the menu to Qt menus, as we can no longer even do the session shortcut change.

The initial focus of the modeling area is a known issue I think.

What is under the cursor should receive the keyboard messages, if the object does not use the shortcut or keycode then it could either bubble up to the parent window or not depending upon design.

Thanks for the replies everyone.

I initially thought that I had done something not correct with model.start_operation and .commit_operation.

With a new day and a cup of coffee, this issue is the Alt key not releasing the Menu Bar focus bug.

I have many shortcuts that use Alt + for assigning tags which had escaped my notice.

ctrl z was not working because the Menu Bar had focus and the reason Alt+Backspace worked was because pressing Alt released the menu bar focus.

Hopefully this bug is going to be fixed soon. I have some keyboard shortcuts that include Alt, too. Pressing Alt again releases the focus. I’m hoping the fix comes soon before the second press of Alt is embedded into muscle memory.

1 Like

In other applications, the menubar focus can also hinder shortcut usage. However (in Notepad++ for example) when the menubar has focus and CTRL+ shortcut is attempted, there is the “brrring” (wrong task) sound … and the menubar focus is cleared.

And yes like any application if giving the menubar focus was a mistake, we must either click outside the menubar or hit ALT again.

But what is supposed to happen (and does in Notepad++) when a valid ALT+ shortcut is used, is that the menubar focus is cleared automatically. This not happpening in 2023.0.

You can test with Paste In Place using ALT+Insert. With some geometry on the clipboard, give the menubar focus by clicking ALT. Then try ALT+Insert. The shortcut works but the menubar focus is not cleared.

The “alt” key activates the menu bar when I use in it in combination with another key as a short cut, then when I go to strike another short cut key either one of the menu bars drop down or nothing happen. I then have to strike the “alt” key again to deactivate the menu bar in order to continue with my work flow. This has been a huge inconvenience since I downloaded sketchup 2023. This has not been an issue in any previous versions.
Thank you for helping by fixing this hugely annoying bug.

Unfortunately, a fix did not make the latest update (23.0.1)

@colin confirmed to me that, yes it had been logged internally by @trent.

Yes it a pain, but an extra click on ALT or ESC or a click on empty space in the modeling area will clear the menu focus.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.