diff --git a/faq.mdx b/faq.mdx index 650bb1ce..0058dfb0 100644 --- a/faq.mdx +++ b/faq.mdx @@ -1,10 +1,10 @@ - + OpenTofu is a Terraform fork, created as an initiative of Gruntwork, Spacelift, Harness, Env0, Scalr, and others, in response to HashiCorp’s switch from an open-source license to the BUSL. The initiative has many supporters, all of whom are listed [here](/supporters). - + The BUSL and the additional use grant outlined by the HashiCorp team are ambiguous, which makes it challenging for companies, vendors, and developers using Terraform to decide whether their actions could be interpreted as being outside the permitted scope of use. @@ -14,13 +14,13 @@ We firmly believe that Terraform should remain open-source because it is a proje - + There will be no differences between Terraform (versions prior to 1.5.x) and OpenTofu. As new versions are released, this will change. - + #### Personal use @@ -36,7 +36,7 @@ Companies will encounter more difficulties with the situation. Switching to a ne - + The community will decide what features OpenTofu will have. Some long-awaited Terraform features will be publicly available soon. @@ -44,32 +44,32 @@ Some companies have pledged to pay for full-time engineers to work on OpenTofu. - + Initially, OpenTofu will be a drop-in replacement for Terraform, as it will be compatible with Terraform versions 1.5.x. You won’t need to make any changes to your code to ensure compatibility. OpenTofu is suitable for production use cases without any exception. - + OpenTofu will work with existing state files up to those created with a version prior to Terraform’s 1.5.x. - + OpenTofu will not have its own providers. Terraform providers have not altered their licenses, and the potential for such a change is virtually zero. OpenTofu will work with the current Terraform providers, but it will use a separate registry. - + The steering committee and the community determine the most important features and bug fixes. The large number of developers pledging their resources to help develop OpenTofu will speed up the development of features and enable faster releases than Terraform managed previously. - + The best way to show practical support for the OpenTofu initiative is to contribute. We recommend you start by [opening an issue](https://github.com/opentofu/opentofu/blob/main/CONTRIBUTING.md) for bug reports, broken compatibility reports, feature requests, old issue reposts, and quality RFCs. @@ -79,7 +79,7 @@ This [contribution guide](https://github.com/opentofu/opentofu/blob/main/CONTRIB - + The pledge is open to all individuals and companies who care about the future of Terraform. You can also support this initiative by starring the manifesto repository on GitHub and spreading the word via share buttons. diff --git a/src/components/Accordion/Item.tsx b/src/components/Accordion/Item.tsx index 1d84e1d5..356f0c40 100644 --- a/src/components/Accordion/Item.tsx +++ b/src/components/Accordion/Item.tsx @@ -1,11 +1,15 @@ import clsx from "clsx"; -import React, { useRef } from "react"; +import { useLocation } from "@docusaurus/router"; + +import React, { useEffect, useRef } from "react"; type AccordionItemProps = { children: React.ReactNode; summary: string; open?: boolean; highlight?: boolean; + id: string; + isHashEnabled?: boolean; }; const classNames = [ @@ -30,8 +34,15 @@ const classNames = [ "font-normal", ]; -const AccordionItem = ({ summary, open, children }: AccordionItemProps) => { +const AccordionItem = ({ + summary, + open, + children, + id, + isHashEnabled, +}: AccordionItemProps) => { const detailsRef = useRef(null); + const location = useLocation(); const handleItemClick = () => { document.querySelectorAll("details.accordion-item").forEach((item) => { @@ -39,8 +50,45 @@ const AccordionItem = ({ summary, open, children }: AccordionItemProps) => { item.removeAttribute("open"); } }); + + if (!detailsRef.current.hasAttribute("open")) { + // Push to end of queue to read updated position and scroll to it + setTimeout(() => { + detailsRef.current.scrollIntoView({ behavior: "smooth" }); + }); + } + + if (!isHashEnabled) { + return; + } + + if (detailsRef.current.hasAttribute("open")) { + window.history.replaceState({ hash: undefined }, "", location.pathname); + } else { + window.history.replaceState( + { hash: id }, + "", + `${location.pathname}#${encodeURI(id)}` + ); + } }; + useEffect(() => { + if (decodeURI(location.hash) === `#${id}` && isHashEnabled) { + document.querySelectorAll("details.accordion-item").forEach((item) => { + if (item !== detailsRef.current) { + item.removeAttribute("open"); + } else { + window.scrollTo({ + top: detailsRef.current.offsetTop, + behavior: "smooth", + }); + item.setAttribute("open", "true"); + } + }); + } + }, []); + return (
( + + ), a: (props) => ( ),