diff --git a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
index 49ce5f7471..0f8594db32 100644
--- a/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
+++ b/Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp
@@ -114,16 +114,18 @@ WebIDL::ExceptionOr NavigableContainer::create_new_child_navigable()
auto parent_doc_state = parent_navigable->active_session_history_entry()->document_state;
- // 2. Let targetStepSHE be the first session history entry in traversable's session history entries whose document state equals parentDocState.
- // NOTE: We need to look for parent document state in parent navigable instead of traversable as specification says. https://github.com/whatwg/html/issues/9686
- auto target_step_she = *(parent_navigable->get_session_history_entries().find_if([parent_doc_state](auto& entry) {
- return entry->document_state == parent_doc_state;
- }));
+ // 2. Let parentNavigableEntries be the result of getting session history entries for parentNavigable.
+ auto parent_navigable_entries = parent_navigable->get_session_history_entries();
- // 3. Set historyEntry's step to targetStepSHE's step.
+ // 3. Let targetStepSHE be the first session history entry in parentNavigableEntries whose document state equals parentDocState.
+ auto target_step_she = *parent_navigable_entries.find_if([parent_doc_state](auto& entry) {
+ return entry->document_state == parent_doc_state;
+ });
+
+ // 4. Set historyEntry's step to targetStepSHE's step.
history_entry->step = target_step_she->step;
- // 4. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
+ // 5. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
DocumentState::NestedHistory nested_history {
.id = navigable->id(),
.entries { *history_entry },