The legislation, which includes language protecting transgender students and teachers, has been a priority of advocates for gay and lesbian rights.