<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Mobile Development on Daniel Zhang</title><link>https://zhangdapeng.dev/tags/mobile-development/</link><description>Recent content in Mobile Development on Daniel Zhang</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 22 Nov 2026 18:00:00 +0800</lastBuildDate><atom:link href="https://zhangdapeng.dev/tags/mobile-development/index.xml" rel="self" type="application/rss+xml"/><item><title>HarmonyOS ArkUI: How to Pass Through Click Events with hitTestBehavior</title><link>https://zhangdapeng.dev/p/harmonyos-arkui-hit-test-behavior-click-event/</link><pubDate>Sun, 22 Nov 2026 18:00:00 +0800</pubDate><guid>https://zhangdapeng.dev/p/harmonyos-arkui-hit-test-behavior-click-event/</guid><description>&lt;img src="https://zhangdapeng.dev/p/harmonyos-arkui-hit-test-behavior-click-event/cover.png" alt="Featured image of post HarmonyOS ArkUI: How to Pass Through Click Events with hitTestBehavior" /&gt;&lt;p&gt;In HarmonyOS application development, you may encounter situations where an upper component intercepts touch events, preventing underlying components from receiving click events.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A transparent overlay prevents users from clicking buttons underneath it.&lt;/li&gt;
&lt;li&gt;A decorative component intercepts touch events even though it does not need interaction.&lt;/li&gt;
&lt;li&gt;A floating component needs to allow clicks to reach underlying components.&lt;/li&gt;
&lt;li&gt;Multiple overlapping components require more flexible touch event handling.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In ArkUI, these scenarios can be handled using the &lt;strong&gt;&lt;code&gt;hitTestBehavior&lt;/code&gt;&lt;/strong&gt; property.&lt;/p&gt;
&lt;p&gt;This article explains how to use &lt;code&gt;hitTestBehavior&lt;/code&gt; and its four common modes to control touch event hit testing.&lt;/p&gt;
&lt;h2 id="1-understanding-hittestbehavior"&gt;1. Understanding hitTestBehavior
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;hitTestBehavior&lt;/code&gt; is an ArkUI component property that controls how a component participates in touch hit testing.&lt;/p&gt;
&lt;p&gt;It determines whether a component and its children participate in hit testing and how touch events are handled when multiple components overlap.&lt;/p&gt;
&lt;p&gt;The property accepts values from the &lt;code&gt;HitTestMode&lt;/code&gt; enumeration.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hitTestBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HitTestMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Default&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The four commonly used modes are:&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Mode&lt;/th&gt;
					&lt;th&gt;Description&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;HitTestMode.Default&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Uses the default hit-testing behavior.&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;HitTestMode.None&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Excludes the component and its subtree from hit testing.&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;HitTestMode.Transparent&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Allows the component and relevant underlying components to participate in hit testing.&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;HitTestMode.Block&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Blocks hit testing from continuing to components underneath it.&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Understanding the differences between these modes is essential when implementing event pass-through behavior.&lt;/p&gt;
&lt;h2 id="2-hittestmodetransparent-allow-events-to-pass-through"&gt;2. HitTestMode.Transparent: Allow Events to Pass Through
&lt;/h2&gt;&lt;p&gt;If you want an upper component to participate in touch handling while also allowing underlying components to receive touch events, use &lt;code&gt;HitTestMode.Transparent&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example, consider a &lt;code&gt;Stack&lt;/code&gt; containing two overlapping components.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;Stack() {&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Underlying Button&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;Row() {&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Transparent Overlay&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fontColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;White&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;#66000000&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hitTestBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HitTestMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Transparent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this example, the upper &lt;code&gt;Row&lt;/code&gt; uses &lt;code&gt;HitTestMode.Transparent&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;This allows the underlying component to participate in hit testing rather than being completely blocked by the overlay.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Typical use cases:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Transparent overlays.&lt;/li&gt;
&lt;li&gt;Decorative components placed above interactive content.&lt;/li&gt;
&lt;li&gt;Floating UI elements that should not completely block underlying interactions.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that &lt;code&gt;Transparent&lt;/code&gt; does not mean that every event is automatically delivered to every overlapping component. The final event dispatch behavior also depends on the component hierarchy and hit-testing rules.&lt;/p&gt;
&lt;h2 id="3-hittestmodenone-completely-ignore-touch-hit-testing"&gt;3. HitTestMode.None: Completely Ignore Touch Hit Testing
&lt;/h2&gt;&lt;p&gt;If a component should not participate in touch hit testing at all, use &lt;code&gt;HitTestMode.None&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;Image&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$r&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;app.media.icon&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hitTestBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HitTestMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;None&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The component and its descendants are excluded from hit testing.&lt;/p&gt;
&lt;p&gt;As a result, underlying interactive components can receive touch events when they are otherwise eligible.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Typical use cases:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Decorative images.&lt;/li&gt;
&lt;li&gt;Background elements.&lt;/li&gt;
&lt;li&gt;Non-interactive overlays.&lt;/li&gt;
&lt;li&gt;UI components that should never intercept user input.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is generally the most straightforward option when an entire component subtree should be ignored during touch hit testing.&lt;/p&gt;
&lt;h2 id="4-hittestmodeblock-prevent-events-from-reaching-underlying-components"&gt;4. HitTestMode.Block: Prevent Events from Reaching Underlying Components
&lt;/h2&gt;&lt;p&gt;Sometimes you need the opposite behavior: an upper component should intercept touch interactions and prevent underlying components from receiving them.&lt;/p&gt;
&lt;p&gt;In this case, use &lt;code&gt;HitTestMode.Block&lt;/code&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;Stack() {&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Underlying Button&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;Column() {&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nx"&gt;Text&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Interaction Blocked&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;fontColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;Color&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;White&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;#66000000&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hitTestBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HitTestMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Block&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;100%&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The upper component blocks hit testing from continuing to underlying components in the overlapping area.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Typical use cases:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Modal overlays.&lt;/li&gt;
&lt;li&gt;Loading masks.&lt;/li&gt;
&lt;li&gt;Interaction-blocking layers.&lt;/li&gt;
&lt;li&gt;Preventing users from interacting with background content while a dialog is displayed.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="5-hittestmodedefault-use-the-default-behavior"&gt;5. HitTestMode.Default: Use the Default Behavior
&lt;/h2&gt;&lt;p&gt;&lt;code&gt;HitTestMode.Default&lt;/code&gt; is the default hit-testing mode.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-typescript" data-lang="typescript"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Click Me&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;hitTestBehavior&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;HitTestMode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Default&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;When this mode is used, ArkUI follows its normal hit-testing and event-dispatch rules.&lt;/p&gt;
&lt;p&gt;For most ordinary UI components, there is no need to explicitly configure this property.&lt;/p&gt;
&lt;h2 id="6-comparison-of-the-four-modes"&gt;6. Comparison of the Four Modes
&lt;/h2&gt;&lt;p&gt;The following table summarizes when to use each mode:&lt;/p&gt;
&lt;table&gt;
	&lt;thead&gt;
			&lt;tr&gt;
					&lt;th&gt;Mode&lt;/th&gt;
					&lt;th&gt;Participates in hit testing&lt;/th&gt;
					&lt;th&gt;Underlying components&lt;/th&gt;
			&lt;/tr&gt;
	&lt;/thead&gt;
	&lt;tbody&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;Default&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Default behavior&lt;/td&gt;
					&lt;td&gt;Follows normal hit-testing rules&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;None&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;No, including descendants&lt;/td&gt;
					&lt;td&gt;Can receive events&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;Transparent&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Yes&lt;/td&gt;
					&lt;td&gt;Can also participate&lt;/td&gt;
			&lt;/tr&gt;
			&lt;tr&gt;
					&lt;td&gt;&lt;code&gt;Block&lt;/code&gt;&lt;/td&gt;
					&lt;td&gt;Yes&lt;/td&gt;
					&lt;td&gt;Blocked from receiving events through that hit-test path&lt;/td&gt;
			&lt;/tr&gt;
	&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;A practical selection guide:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Want the component to be completely ignored?&lt;/strong&gt; Use &lt;code&gt;None&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Want the component and underlying components to participate?&lt;/strong&gt; Use &lt;code&gt;Transparent&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Want to block interactions underneath?&lt;/strong&gt; Use &lt;code&gt;Block&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Want normal ArkUI behavior?&lt;/strong&gt; Use &lt;code&gt;Default&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="7-important-notes"&gt;7. Important Notes
&lt;/h2&gt;&lt;p&gt;When implementing touch event pass-through, keep the following points in mind.&lt;/p&gt;
&lt;h3 id="71-transparent-does-not-mean-event-bubbling"&gt;7.1 Transparent Does Not Mean Event Bubbling
&lt;/h3&gt;&lt;p&gt;&lt;code&gt;HitTestMode.Transparent&lt;/code&gt; is related to hit testing, not simply event bubbling.&lt;/p&gt;
&lt;p&gt;ArkUI has its own event dispatch mechanism. Event bubbling, event interception, and hit testing are different concepts.&lt;/p&gt;
&lt;p&gt;If your requirement is to allow an underlying sibling component to receive a click, configure the hit-testing behavior appropriately instead of relying only on event bubbling.&lt;/p&gt;
&lt;h3 id="72-consider-the-component-hierarchy"&gt;7.2 Consider the Component Hierarchy
&lt;/h3&gt;&lt;p&gt;The final hit-testing result depends on the layout hierarchy.&lt;/p&gt;
&lt;p&gt;For example, when using &lt;code&gt;Stack&lt;/code&gt;, multiple components can occupy the same position. Their hit-testing behavior determines which components are eligible to receive touch events.&lt;/p&gt;
&lt;p&gt;For &lt;code&gt;Row&lt;/code&gt; and &lt;code&gt;Column&lt;/code&gt;, components are generally arranged sequentially, so overlapping behavior may be less relevant.&lt;/p&gt;
&lt;h3 id="73-test-on-the-target-harmonyos-version"&gt;7.3 Test on the Target HarmonyOS Version
&lt;/h3&gt;&lt;p&gt;ArkUI APIs and interaction behavior may vary across SDK versions.&lt;/p&gt;
&lt;p&gt;When implementing more complex overlays or custom components, verify the behavior using the target HarmonyOS SDK and actual device testing.&lt;/p&gt;
&lt;h2 id="8-conclusion"&gt;8. Conclusion
&lt;/h2&gt;&lt;p&gt;In HarmonyOS ArkUI, &lt;code&gt;hitTestBehavior&lt;/code&gt; provides a convenient way to control how components participate in touch hit testing.&lt;/p&gt;
&lt;p&gt;The most important thing is to choose the correct &lt;code&gt;HitTestMode&lt;/code&gt; according to the interaction requirement:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Default&lt;/code&gt;: Follow the default behavior.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;None&lt;/code&gt;: Completely ignore hit testing.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Transparent&lt;/code&gt;: Allow underlying components to participate in hit testing.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Block&lt;/code&gt;: Prevent interactions from reaching underlying components.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For most click-through scenarios, &lt;code&gt;None&lt;/code&gt; and &lt;code&gt;Transparent&lt;/code&gt; are the two modes worth understanding first.&lt;/p&gt;
&lt;p&gt;Choosing the correct mode can help avoid unnecessary event interception and make overlapping UI components easier to manage.&lt;/p&gt;</description></item></channel></rss>