microsoft / microsoft/FeatureManagement-Dotnet

feat: Support for an attribute-based feature toggling TagHelper

Open
#483 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
1.2k
Forks
129
Avg merge
1d 1h
Merged PRs (30d)
5

Description

I think this would be extremely straightforward to implement and make for a tidier, less disruptive use of the tag helper.

<ul>
  <!-- Suggestion -->
  <li feat-name="" feat-requirement="" feat-negate="">MenuItem</li>

  <!-- Current -->
  <feature name="" requirement="" negate="">
    <li>MenuItem</li>
  </feature>
</ul>

Required changes:

  • Copy FeatureTagHelper into FeatTagHelper (or FeatureAttributeTagHelper)
  • Annotate with [HtmlTargetElement(Attributes = nameof(FeatName))]
  • Prefix property names with Feat
  • Remove output.TagName = null; so the existing HTML element stays in place
  • Remove the feat- attributes off the rendered element
  • Potentially abstract out an abstract base class to share code between attributes
    • output.TagName = null; can be run if output.TagName == "feature"

It's really quite similar to the ConditionTagHelper in the docs here.

I'm happy to implement this as a PR if it will be accepted. I'll probably be creating one in our repo in the short term.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing FeatureTagHelper and compare its behavior with the ConditionTagHelper pattern linked in the issue. Implement the attribute-based variant or shared abstraction as appropriate, preserving the original HTML element and removing feature attributes from rendered output; verify both existing and new tag-helper behavior with the repository's tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
frontend, web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.