Scirra / Construct-bugs

Public bug report submissions for Construct 3 and Construct Animate. Please read the guidelines then click the 'Issues' tab to get started.
https://www.construct.net
108 stars 83 forks source link

Hitting the "Tab" key cancels "Mouse button is pressed" state #8081

Closed SPECT0R1A closed 3 months ago

SPECT0R1A commented 3 months ago

Problem description

Hitting the Tab key somehow cancels the fact that the Mouse button is pressed. In the attached project, a sprite is set to be positioned to Mouse.X/Mouse.Y when mouse button is pressed. Hitting tab cancels that state. This is annoying in a game with an inventory that opens/closes with the tab button while dragging items and creates an unwanted behavior.

Attach a .c3p

TabKey.zip

Steps to reproduce

The project only has two elements to demonstrate the effect that hitting Tab has on an event that relies on "Mouse button is down". When picking up the apple, the action is supposed to maintain the sprite on the mouse cursor, however, tab disables that event. Tested on browser mode, in fullscreen and nwjs.

STEPS:

Observed result

Mouse button down is ignored.

Expected result

Hitting tab shouldn't affect anything since there's no event calling its use.

More details

Tested on latest beta version.

First affected release:

System details

Platform information Product: Construct 3 r396 (beta) Browser: Chrome 126.0.6478.114 Browser engine: Chromium Context: webapp Operating system: Windows 11 Device type: desktop Device pixel ratio: 1 Logical CPU cores: 6 Approx. device memory: 8 GB User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Language setting: en-US

Local storage Storage quota (approx): 1.1 tb Storage usage (approx): 2.2 gb (0.2%) Persistant storage: No

Browser support notes This list contains missing features that are not required, but could improve performance or user experience if supported.

Nothing is missing. Everything is OK! WebGL information Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium) Numeric version: 2 Supports NPOT textures: yes Supports GPU profiling: no Supports highp precision: yes Vendor: Google Inc. (NVIDIA) Renderer: ANGLE (NVIDIA, NVIDIA GeForce GTX 1080 Ti (0x00001B06) Direct3D11 vs_5_0 ps_5_0, D3D11) Major performance caveat: no Maximum texture size: 16384 Point size range: 1 to 1024 Extensions:

EXT_clip_control EXT_color_buffer_float EXT_color_buffer_half_float EXT_conservative_depth EXT_depth_clamp EXT_disjoint_timer_query_webgl2 EXT_float_blend EXT_polygon_offset_clamp EXT_render_snorm EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic EXT_texture_mirror_clamp_to_edge EXT_texture_norm16 KHR_parallel_shader_compile NV_shader_noperspective_interpolation OES_draw_buffers_indexed OES_sample_variables OES_shader_multisample_interpolation OES_texture_float_linear OVR_multiview2 WEBGL_blend_func_extended WEBGL_clip_cull_distance WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL_lose_context WEBGL_multi_draw WEBGL_polygon_mode WEBGL_provoking_vertex WEBGL_stencil_texturing Audio information System sample rate: 48000 Hz Output channels: 2 Output interpretation: speakers Supported decode formats:

WebM Opus (audio/webm;codecs=opus) WebM Vorbis (audio/webm;codecs=vorbis) MPEG-4 Opus (audio/mp4;codecs=opus) MPEG-4 AAC (audio/mp4;codecs=mp4a.40.2) MP3 (audio/mpeg) FLAC (audio/flac) PCM WAV (audio/wav;codecs=1) Supported encode formats:

WebM Opus (audio/webm;codecs=opus) MPEG-4 Opus (audio/mp4;codecs=opus) MPEG-4 AAC (audio/mp4;codecs=mp4a.40.2) Video information Supported decode formats:

WebM AV1 (video/webm;codecs=av01.0.00M.08) WebM VP9 (video/webm;codecs=vp9) WebM VP8 (video/webm;codecs=vp8) MPEG-4 AV1 (video/mp4;codecs=av01.0.00M.08) MPEG-4 H.265 (video/mp4;codecs=hev1.1.2.L93.B0) MPEG-4 H.264 (video/mp4;codecs=avc1.420034) Supported encode formats:

WebM AV1 (video/webm;codecs=av01.0.00M.08) WebM VP9 (video/webm;codecs=vp9) WebM VP8 (video/webm;codecs=vp8) WebM H.264 (video/webm;codecs=avc1.420034) MPEG-4 VP9 (video/mp4;codecs=vp9) MPEG-4 H.264 (video/mp4;codecs=avc1.420034)

View details PASTE HERE
WilsonPercival commented 3 months ago

Could you please write down the steps to reproduce the problem as written in the crash reporting guidelines?

I tried holding down the left mouse button and then pressing the Tab key, but the sprite continues to follow the cursor.

SPECT0R1A commented 3 months ago

I updated the report with steps to reproduce. Thank you @WilsonPercival

WilsonPercival commented 3 months ago

Yes, now I can reproduce. The important step was to not move the mouse.

SPECT0R1A commented 3 months ago

I made this example quickly and didn't think of a better way to demonstrate the bug but the fact is that there is absolutely no reference to the "tab" key in the events but it still affects the game.

AshleyScirra commented 3 months ago

When you press tab, focus changes to part of the browser UI. This takes focus away from the web content, and so input is lost. It's basically the same as pressing Alt+Tab and switching to an entirely different app: once you switch away that counts the mouse button as not being pressed, even if you are still holding the physical mouse button, since otherwise the input state gets stuck. The same thing is happening here and this is currently by design.