Closed shkim closed 2 years ago
Do you have all the latest commits from the main
branch? There was a bug that was fixed a couple weeks ago that would cause webpages to become stuck after visiting modals. I'm not able to replicate the issues you're describing.
I'm seeing the ic_close
icon always displayed on the WebHomeFragment
using your code - even after visiting modals.
I think I'm using the latest commit.
$ git log
commit 947c18884c9615c5e302164cde3129ec1725fa93 (HEAD -> main, tag: 7.0.0-rc1, origin/main, origin/HEAD)
Merge: 42b4883 b836b8d
Author: Jay Ohms <jay.ohms@gmail.com>
Date: Tue Sep 7 21:19:06 2021 -0400
Merge pull request #175 from hotwired/same-page-anchors
Support same-page anchor scrolling
...
$ git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .idea/codeStyles/Project.xml
modified: demo/src/main/kotlin/dev/hotwire/turbo/demo/features/web/WebHomeFragment.kt
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/gradle.properties
demo/.idea/
Can you provide a screen recording of the behavior you're seeing in the demo app?
Thanks, that's helpful. Here's how you can work around these issues:
@TurboNavGraphDestination(uri = "turbo://fragment/web/home")
class WebHomeFragment : WebFragment() {
// ...
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
configureToolbar()
}
override fun shouldObserveTitleChanges(): Boolean {
return false
}
override fun toolbarForNavigation(): Toolbar? {
// Disable the automatic toolbar navigation configuration
return null
}
private fun configureToolbar() {
view?.findViewById<Toolbar>(R.id.toolbar)?.apply {
navigationIcon = ContextCompat.getDrawable(requireContext(), R.drawable.ic_close)
setNavigationOnClickListener {
// Custom code here to open menu
Toast.makeText(requireContext(), "Display menu", Toast.LENGTH_LONG).show()
}
}
}
}
This works great from my end, so let me know if that doesn't address everything!
I need a hamburger button on left side of toolbar, but it is disappeared when a modal page is dismissed.
These are the reproduction steps to modify the "demo" project:
Edit ~/turbo-android/demo/src/main/kotlin/dev/hotwire/turbo/demo/features/web/WebHomeFragment.kt add the following method below onCreateView (two imports will be automaticaly added by IDE)
2b. I'm not sure but with my all devices and emulator, after I click the close icon, the web page changed to non-interactive mode; I could not scroll or click any links on the page. Is it an expected behavior?