Comments (6)
Yes, adding href
to handledProps in MenuItem
is my plan.
@levithomason - any strong reason against removing if (props.href) return 'a'
from getElementType()
?
from fluent-ui-react.
getElementType()
takes getDefault
parameter but renderComponent()
never sets that. There is no way how a Component could override that.
@levithomason, @mnajdova, @kuzhelov - before stardust-ui/react-old#21 there was such a possibility. Can we add it back?
from fluent-ui-react.
Agree that using getDefault
parameter of getElementType()
function might be a first step to resolve this problem.
At the same time, the following line of getElementType
seems like a black magic to me:
// ----------------------------------------
// infer anchor links
if (props.href) return 'a'
Where this functionality might come in need? It seems to be always possible for a client to specify as='a'
alongside with href
, so that desired effect would be achieved - and achieved with reasonable explicitness. And the fact that in case of href
being specified component type suddenly changes its dress to appear as a
- this is really weird and unexpected thing to me (at least certainly for those cases where component's as
value is specified in its defaultProps
).
So, my suggestion would be to avoid this 'implicit "a"', and as further steps - introduce href
as handled prop of MenuItem
, so that component will take care of where this attribute should be plaved in its components' tree:
// MenuItem
renderComponent({ ElementType, classes, accessibility, rest }) {
const { children, content, icon, href } = this.props
const hasChildren = childrenExist(children)
return (
<ElementType ... href={hasChildren ? href : undefined} {...rest}>
{ hasChildren ? children
: (
<a href={href} ... >
...
</a>
)}
</ElementType>
)
}
from fluent-ui-react.
delete it 👍
from fluent-ui-react.
on top of what was mentioned, all attributes relevant to the <a>
need to be rendered on the anchor - href
, rel
, target
, ...
from fluent-ui-react.
Fixed by #323
from fluent-ui-react.
Related Issues (20)
- Memory leaks in FocusZone due to DOM object references not getting cleaned up
- Dropdown onSelectedChanged typings incorrect
- Bundle size: Single `themes` import imports all themes
- Bundle size: theme import imports several components HOT 2
- Toolbar with menu: trigger button always opens menu instead of toggling it
- Input's fluid property no effect when it is in a Form.Field?
- Dropdown value is [object Object] when selecting an item that is an object using DropdownItemProps HOT 3
- Carousel throws getItemPositionText is not a function
- How to change the Dropdown's container width? It is 22.25rem for now.
- Animation with no children throws
- Can't add custom colors to colorScheme? HOT 1
- Which technology to choose: office-ui-fabric-react vs fluent-ui-react HOT 1
- Toolbar overflow menu is misaligned/shifting rest of a page when clicked
- Tooltip: wrong outline on Button
- Popup: `offset` breaks arrow pointer
- [RFC] Implementing reveal highlight
- Popup: pointing beak is broken on edges HOT 1
- AccordionTitle content is not exposed as a slot
- README.md: Broken link in the "Why?" section
- Safari: Wrong focus indicator on Input
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fluent-ui-react.