daohoangson / flutter_widget_from_html

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.
https://pub.dev/packages/flutter_widget_from_html
MIT License
645 stars 242 forks source link

Can't navigate to focus html elements like buttons #1362

Open deandreamatias opened 1 week ago

deandreamatias commented 1 week ago

Steps to Reproduce

Create a simple HtmlWidget with a (link) element. Tested on: SM S911B (mobile)

HTML ```html

Test link:


https://github.com/

```
`HtmlWidget` configuration ```dart HtmlWidget( html, customWidgetBuilder: (element) { if (element.localName == 'p') { final list = element.getElementsByTagName(element.localName ?? 'p'); for (final tag in list) { return Text( tag.text, ); } } if (element.localName == 'strong') { final list = element.getElementsByTagName(element.localName ?? 'strong'); for (final tag in list) { return Text( tag.text, ); } } if (element.localName == 'a') { final list = element.getElementsByTagName(element.localName ?? 'a'); for (final tag in list) { return Text( tag.text, ); } } if (element.localName == 'body') { final list = element.getElementsByTagName(element.localName ?? 'body'); for (final tag in list) { return Text( tag.text, ); } } return null; }, onTapUrl: (url) async { if (url.isNotEmpty) { await UrlLauncherUtil.launchPage(Uri.parse(url)); return true; } return false; }, ); ```
Tesing environment ``` [✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale en-ES) • Flutter version 3.24.3 on channel stable at /Users/matias/fvm/versions/3.24.3 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (9 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3 [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at /Users/matias/Library/Android/sdk • Platform android-35, build-tools 35.0.0 • ANDROID_HOME = /Users/matias/Library/Android/sdk • Java binary at: /opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment Homebrew (build 17.0.12+0) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 16.0) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 16A242d • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2024.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • android-studio-dir = /Applications/Android Studio.app • Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11) [✓] VS Code (version 1.95.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.100.0 [✓] Connected device (5 available) • SM S911B (mobile) • R5CW803ASFW • android-arm64 • Android 14 (API 34) • Matias iPhone (mobile) • 00008110-000E55223A7A201E • ios • iOS 18.0 22A3354 • macOS (desktop) • macos • darwin-arm64 • macOS 15.0 24A335 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.0 24A335 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.117 [✓] Network resources • All expected network resources are available. • No issues found! ```

Expected results

When try to navigate with keyboard on Flutter app with HtmlWidget, can focus on button that render on tags

Actual results

When try to navigate with keyboard on Flutter app with HtmlWidget, can't focus on button that render on tags